I am running into an issue whereby it appears that BodyTags don't seem to
allow jsp:includes in them (exception attached). It seems like this makes
BodyTags basically useless with a JSP body content, because restricting
people to not use jsp:include is unreasonable and certainly very subtle.
For instance, Tomcat comes with an "iteration example". If you add a simple
jsp:include in the index.jsp ($TOMCAT_HOME/webapps/iteration/index.jsp):
<tlt:iteration name="departmentName" type="String"
group="<%= org.getDepartmentNames()%>">
<tr>
<td> <jsp:include page="test.jsp" flush="true"/><a
href="list.jsp?deptName=<%= departmentName %>"><%= departmentName
%></a></td>
</tr>
</tlt:iteration>
You get the following exception:
java.io.IOException: Illegal to flush within a custom tag
at javax.servlet.jsp.tagext.BodyContent.flush(BodyContent.java:87)
at
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:407)
at
_0002findex_0002ejspindex_jsp_3._jspService(_0002findex_0002ejspindex_jsp_3.
java:116)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:309)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:382)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:387)
at org.apache.tomcat.core.Handler.service(Handler.java:263)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:371)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:78
6)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:732)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
Has anybody seen this issue before or have any comments on if it is the
"desired" behavior? Seems like a bug to me.
thanks
gt