You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Timo --Blazko-- Boewing <bl...@neveprise.net> on 2003/11/01 15:57:08 UTC
JSP 2.0: probs w/ JSTL and jsp:doBody
Hello List,
Currently i am trying JSP 2.0 w/ Servlet 2.4 under Tomcat 5.0.12. One of
the things i love the most is tag templates for usage in WEB-INF/tags.
I use current Apache JSTL 1.1 w/ up to date Struts on Debian GNU/Linux
and J2SE SDK 1.4.1_02.
However, as soon as i have JSTL in a JSP page and in between my tags
that have jsp:doBody in it OR when i have tags w/ jsp:doBody and e.g. a
c:forEach in the body (the JSP, not within tags, that works pretty much.
Here an example:
test.jsp --------------------------------
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="my" tagdir="/WEB-INF/tags/" %>
<my:simple caption="${param.cap}">
<c:forEach items="${aHashMap}" var="entry">
<li>${entry.key}</li>
</c:forEach>
</my:simple>
simple.tag --------------------------------
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="caption" %>
<h1>${caption}</h1>
<ul>
<jsp:doBody />
</ul>
I have read much docs, including Sun's JSP 2.0 current proposal, but
cannot guess what the solution might me. I think it has to do w/ current
JSP context, but have no idea how to fix this or if this is possible at
all. One workaround is to avoid jsp:doBody and split the tag into two
files, e.g. <my:simple caption="x" / >[JSTL here]<my:simpleEnd />, but
that is somehow not nice...
The exceptions i receive look like these.
Thank you for any hints!
Timo
>>>
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 15 in the jsp file: /themes/default/jsp/admin/view/view/show.jsp
Generated servlet error:
[javac] Compiling 1 source file
/home/blazko/workspace/neveprise.net/work/org/apache/jsp/org/apache/jsp/themes/default_/jsp/admin/view/view/show_jsp.java:224: cannot resolve symbol
symbol : variable _jspx_push_body_count_c_forEach_0
location: class org.apache.jsp.themes.default_.jsp.admin.view.view.show_jsp.show_jspHelper
if (_jspx_meth_scav_tabButton_0(_jspx_parent, pageContext, _jspx_push_body_count_c_forEach_0))
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:128)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:413)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1759)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat
logs.
<<<
--
greetings, | /"\
| \ / ASCII-Ribbon-Campaign
Timo | X Against HTML Mail
| / \
----------------------------------------------------------------------
PUBLIC KEY:
52F3311A Timo Boewing <bl...@neveprise.net> 2003/10/30
Fingerprint = F743 E0AA A2F0 1B33 F6FA 417B 72BE 740D 52F3 311A