- This topic has 3 replies, 2 voices, and was last updated 18 years, 7 months ago by Thomas Bednarz.
-
AuthorPosts
-
Thomas BednarzMemberI have a problem with the following code in a jsp file:
<TR> <TD colspan="2"> <c:choose> <c:when test="${hasRequestedPwd}"> <bean:message key="Login.pwdemailinfo"/> </c:when> <c:otherwise> <bean:message key="Login.advice"/> </c:otherwise> </c:choose> </TD> </TR>
I get back the following error:
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /form/userLogin.jsp(24,6) According to TLD or attribute directive in tag file, attribute test does not accept any expressions
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)I run Tomcat 5.5 which should be able to evaluate an expression such as above at runtime. In my Struts action I have the following code to set the property:
if (Success) { request.setAttribute("hasRequestedPwd", new Boolean(true)); request.setAttribute("subscriberID", generatePasswordForm.getLoginName()); return mapping.findForward("success"); }
Thomas BednarzMemberI found out what the problem is!
It seems to be required to use the following taglib:
<%@ taglib uri=”http://java.sun.com/jstl/core_rt” prefix=”c”%>
I used just core.
Can anybody explain what the differences between core and core_rt are and when to use which taglib? Is this also dependent on the version of JSTL / JSP / Servlet the container supports or what versions of libraries I use?
Many thanks
Thomas
Scott AndersonParticipantThomas,
The difference is that _rt taglibs are later releases that understand JSP expression language and the earlier releases do not. That’s why changing the taglib fixed the issue. So, if you’re using expressions use the xxx_rt taglibs.
Is this also dependent on the version of JSTL / JSP / Servlet the container supports or what versions of libraries I use?
Yes, it is. You’ll need a container that supports the latest spec in order to use expression language properly. However, it appears you’re already doing that in this case.
Thomas BednarzMemberOK, thanks a lot.
Thomas
-
AuthorPosts