當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。