You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jerry Rodgers <jr...@aravo.com> on 2004/12/04 21:06:32 UTC

Tomcat 5.0.28 - How to stop Jasper JSP compiler from evaluting JSTL expressions

Hi, 

 

I am having a problem where the parameter this is passed to my setItems()
method of the jstl forEach tag is actually the .toString() version of my
collection. This appears to be because the servlet code generated by Tomcat
- Jasper actually evaluates the expression and then use the coerce to string
on my collection. I was under the impression that the generated jsp code
should only set the items property to the runtime expression and then the
tag is actually the one that evaluates the expression. 

 

Here is the problem/question. How do I make Tomcat NOT evaluate my
expression in the JSP because the jstl for:each tags actually have the
expression evaluation built into them.  Just as a test when I changed the
value of the parameter in the setItems() back to my expression "${topnav}" -
then hit resume my page works correctly.  What I am currently passed by
Jasper is a long string that is the .toString() on all my items. 

 

// Tomcat generated this 

 _jspx_th_core_forEach_0.setItems((java.lang.String)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${topnav}",
java.lang.String.class, (PageContext)_jspx_page_context, null, false));

 

// Weblogic generated this, 

_core_forEach0.setItems(weblogic.utils.StringUtils.valueOf("${topnav}"));
//[ /layout/nav/top/default.jsp; Line: 13]

 

When I tried to set the <rtexpression>false</rtexpression> in the tld for
the items attribute then of course jasper complained and gave me this
exception.

org.apache.jasper.JasperException: /layout/default.jsp(14,4) According to
TLD or attribute directive in tag file, attribute items does not accept any
expressions

 

I need jasper to allow the expression but not execute it. How do I do this?

 

>> Other details. - my jsp page 

<tiles:importAttribute />

<core:forEach var="menuItem" varStatus="status" items="${topnav}">

             <html:message name="menuItem" property="value"/>

</core:forEach>

 

I have tested this with both version 1.0.6 and 1.1. of the jstl tags. Same
behavior in both. It doesn't appear to be the tags fault but rather Jasper. 

 

Thanks everyone,

Jerry