当前位置: 首页>>代码示例>>Java>>正文


Java PageContext.getOut方法代码示例

本文整理汇总了Java中javax.servlet.jsp.PageContext.getOut方法的典型用法代码示例。如果您正苦于以下问题:Java PageContext.getOut方法的具体用法?Java PageContext.getOut怎么用?Java PageContext.getOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.jsp.PageContext的用法示例。


在下文中一共展示了PageContext.getOut方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 * Write the specified text as the response to the writer associated with
 * this page.  <strong>WARNING</strong> - If you are writing body content
 * from the <code>doAfterBody()</code> method of a custom tag class that
 * implements <code>BodyTag</code>, you should be calling
 * <code>writePrevious()</code> instead.
 *
 * @param pageContext The PageContext object for this page
 * @param text The text to be written
 *
 * @exception JspException if an input/output error occurs (already saved)
 */
public void write(PageContext pageContext, String text)
        throws JspException {

    JspWriter writer = pageContext.getOut();

    try {
        writer.print(text);

    } catch (IOException e) {
        TagUtils.getInstance().saveException(pageContext, e);
        throw new JspException
                (messages.getMessage("write.io", e.toString()));
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:TagUtils.java

示例2: writePrevious

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
/**
 * Write the specified text as the response to the writer associated with
 * the body content for the tag within which we are currently nested.
 *
 * @param pageContext The PageContext object for this page
 * @param text The text to be written
 *
 * @exception JspException if an input/output error occurs (already saved)
 */
public void writePrevious(PageContext pageContext, String text)
        throws JspException {

    JspWriter writer = pageContext.getOut();
    if (writer instanceof BodyContent) {
        writer = ((BodyContent) writer).getEnclosingWriter();
    }

    try {
        writer.print(text);

    } catch (IOException e) {
        TagUtils.getInstance().saveException(pageContext, e);
        throw new JspException
                (messages.getMessage("write.io", e.toString()));
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:TagUtils.java

示例3: doGet

import javax.servlet.jsp.PageContext; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

    PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(
            this, req, resp, null, false, JspWriter.DEFAULT_BUFFER, true);
    JspWriter out = pageContext.getOut();
    if (Constants.DEFAULT_BUFFER_SIZE == out.getBufferSize()) {
        resp.getWriter().println("OK");
    } else {
        resp.getWriter().println("FAIL");
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:TestPageContextImpl.java


注:本文中的javax.servlet.jsp.PageContext.getOut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。