facebook

Problem if evaluation of expressions at runtime

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #249700 Reply

    I 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");
            }
    
    
    #249702 Reply

    I 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&#8221; 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

    #249754 Reply

    Scott Anderson
    Participant

    Thomas,

    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.

    #249829 Reply

    OK, thanks a lot.

    Thomas

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Problem if evaluation of expressions at runtime

You must be logged in to post in the forum log in