tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "P'Simer, Dana" <dana.psi...@corp.bellsouth.net>
Subject Possible Bug in custom tag support.
Date Mon, 12 Jun 2000 18:00:39 GMT
Please let me know if I am in error on any of this stuff.
 
I get the following output from the JSP below when its webapp is mapped to
/proof and I point my browser to http://localhost:8080/proof/proof.jsp
<http://localhost:8080/proof/proof.jsp> .  I got a similar problem using
ServletExec v3.0 and was checking out tomcat since it is supposed to be the
reference implementation.  The problem appears to be in the implementation
of the jsp:include tag inside a custom tag.  The spec is quite clear that
all JSP code, standard actions, and custom tags must be evaluated and their
output captured into the bodyContent's stream before it is passed to
doAfterBody.  What appears to be happening is that the IncludeGenerator
class is generating a call to flush before the generated call to
pageContext.include.  I looked at the pageContext.include function and it
just gets a request dispatcher from the context and calls
RequestDispatcher.include.  This will not work.  Somehow the
RequestDispatcher.include function needs to be passed the output stream.
Currently the output stream that it gets is the one in the response.  If it
weren't for the error I am getting below we would see the same result I got
from ServletExec v3.0:  The output of the includes would be stacked together
before the other contents of the custom tag.
 
--- proof.jsp
----------------------------------------------------------------------------
-----------------------
 
<%@page language="java"%>
<%@taglib uri="/proof-taglib" prefix="proof"%>
<html>
 <body>
  <H1>Quoted Contents of FOO.HTML:</H1>
  <PRE>
   <proof:hquote>
    &lt;---------------- cut ------------------------&gt;
    <jsp:include page="/foo.html" flush="true"/>
    <H2>This is some included text</H2>
    &lt;---------------- cut ------------------------&gt;
   </proof:hquote>
  </PRE>
 </body>
</html>
 
--- note:
----------------------------------------------------------------------------
---------------------------
 
    hquote is a simple BodyTagSupport descendant that processes the contents
of the body and replaces '<', '>', 
    and '&' with their respective entity formats so that the user sees the
HTML is presented instead of its 
    interpretation.
 
--- output
----------------------------------------------------------------------------
--------------------------
<h1>Error: 500</h1>
<h2>Location: /proof/proof.jsp</h2><b>Internal Servlet Error:</b><br>
<pre>
javax.servlet.ServletException: Illegal to flush within a custom tag
        at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:386)
        at
_0002fproof_0002ejspproof_jsp_0._jspService(_0002fproof_0002ejspproof_jsp_0.
java:112)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:174)
        at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
        at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:160)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
        at java.lang.Thread.run(Thread.java:479)
</pre>
<b>Root cause:</b>
<pre>
java.io.IOException: Illegal to flush within a custom tag
        at javax.servlet.jsp.tagext.BodyContent.flush(BodyContent.java:87)
        at
_0002fproof_0002ejspproof_jsp_0._jspService(_0002fproof_0002ejspproof_jsp_0.
java:85)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:174)
        at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
        at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:160)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
        at java.lang.Thread.run(Thread.java:479)
</pre>
----------------------------------------------------------------------------
-------------------------------------
 
Thanks,

Dana H. P'Simer, Jr.
678/441-7547
dana.psimer@corp.bellsouth.net <mailto:dana.psimer@corp.bellsouth.net> 
danap@dhptech.com <mailto:danap@dhptech.com> 

The opinions stated here are my own and do not, in any way, represent the
opinions of BellSouth, any BellSouth subsidiary or business unit or any of
its partners or providers.

 

Mime
View raw message