EL tags not parsed in JSP 2.0 environment
The EL tags are not parsed in the JSP 2.0 environment. I am using Weblogic 9.2 server. The following are the snippets from my JSP
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html-el:link page="/getrate.ex?rateCode=${rate}" >
<c:out value="${rate}"/>
</html-el:link>
In the above jsp, the value for rate bean is displayed correctly by c:out tag. But the html:el-link does not parse the /getrate.ex?rateCode=${rate} properly. It shows as ${rate} instead of parsing the value of the rate bean.The same code works fine in weblogic 8.1 environment.
I have tried the following things
1. Migrated the web.xml from 2.3 to 2.4 version
2. JSTL 1.1 libraries are placed in the WEB-INF/lib directory (standard.jar, jstl.jar)
3. If I add the statement <%@ page isELIgnored="false" %> in JSP, then the
<c:out value="${rate}"/> also gives error
Do I need to get a struts-el.jar that is compatible with JSTL 1.1?
Can you please let me know how to solve this issue?
Thanks,
Balaji
# 1
You have missed one step in the upgrade. When you move from JSTL1.0 to JSTL1.1 the uri for importing the tag library needs to change.
From <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
To <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
(note the extra /jsp in there)
There is a similar change for all the JSTL tag libraries.
If you have a JSP2.0 container, then EL expressions are treated as just regular runtime expressions. That means you can use ${expr} anywhere you previously used <%= expr %>
So - you no longer need the special "struts-el" tags. You can use the standard struts tags that accept runtime expressions.
The other thing I am not sure of is that you are using the expression as part of a value. That doesn't normally work well in struts - either the whole value should be a runtime expression, or none of it. I'm not sure if the same applies to EL, but it definitely applies to standard expressions.
ie <html:link page="/getrate.ex?rateCode=<%= rate%>" > is invalid and needs to be
<html:link page="<%= "/getrate.ex?rateCode=" + rate %>" >
I would suggest you use the tags properties to provide the parameter.
// upgrade uri to JSTL1.1
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
// use standard struts html taglib
<html:link page="/getrate.ex" paramId="rateCode" paramName="rate" >
<c:out value="${rate}"/>
</html:link>
Cheers,
evnafets