Jahia in English > Cannot use EL 2.2

0 (0 Good)
0 (0 Bad)

Cannot use EL 2.2

by  sbarriball »  2014/10/02 13:51

I'm not able to use JSP Expression Language 2.2 despite using a servlet 3.0 container.

I've tried updating the servlet version declared in the web.xml to version="3.0" and dumping the servlet version in a jsp shows version 3 

but any attempts to call methods within an expression e.g.

    <jsp:useBean id="today" class="java.util.Date" scope="page" />

    ${today.compareTo(1)}

results in an evaluation failure

Caused by: org.apache.jasper.JasperException: /PWC6296: The function compareTo must be used with a prefix when a default namespace is not specified

where the same code in a simple webapp running within the same tomcat 7 server evaluates correctly and gives

org.apache.jasper.JasperException: javax.el.ELException: java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Date

 

 

  • Cannot use EL 2.2
    2014/10/02 13:51

    sbarriball <p>I&#39;m not able to use JSP Expression Language 2.2 despite using a servlet 3.0 container.</p> <p>I&#39;ve tried updating the servlet version declared in the web.xml to version=&quot;3.0&quot; and dumping the servlet version in a jsp shows version 3&nbsp;</p> <p>but any attempts to call methods within an expression e.g.</p> <p class="p1"><span class="s1">&nbsp; &nbsp;&nbsp;</span><span class="s2">&lt;</span><span class="s3">jsp:useBean</span><span class="s1"> </span><span class="s4">id</span><span class="s1">=</span>&quot;today&quot;<span class="s1"> </span><span class="s4">class</span><span class="s1">=</span>&quot;java.util.Date&quot;<span class="s1"> </span><span class="s4">scope</span><span class="s1">=</span>&quot;page&quot;<span class="s1"> </span><span class="s2">/&gt;</span></p> <p class="p1"><span style="line-height: 1.6;">&nbsp; &nbsp; ${today.compareTo(1)}</span></p> <p>results in an evaluation failure</p> <p class="p1">Caused by: org.apache.jasper.JasperException: /PWC6296: The function compareTo must be used with a prefix when a default namespace is not specified</p> <p class="p1">where the same code in a simple webapp running within the same tomcat 7 server evaluates correctly and gives</p> <pre style="color: rgb(0, 0, 0); line-height: normal;"> org.apache.jasper.JasperException: javax.el.ELException: java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Date</pre> <p class="p1">&nbsp;</p> <p class="p1">&nbsp;</p>

  • Number of messages  10
    Registration date Oct 2, 2014
    0 (0 Good)
    0 (0 Bad)

    Re: Cannot use EL 2.2

    by  sbarriball »  2014/10/14 13:12

    So to answer my own question on this , the JSP Compiler an EL version is provided by an OSGI module called PAX-WEB which is not the same as the version provided by your Servlet Container. 

    It seems as though EL2.2 support is not being added to PAX-WEB until 4.0 whereas Jahia is using 3.x.

    I may look at adding EL2.2 via a 3rd party library e.g. JBOSS-EL, and will post to this forum if i find an answer.

  • Re: Cannot use EL 2.2
    2014/10/14 13:12

    sbarriball <p style="line-height: 20.7999992370605px;">So to answer my own question on this , the JSP Compiler an EL version is provided by an OSGI module called PAX-WEB which is not the same as the version provided by your Servlet Container.&nbsp;</p> <p style="line-height: 20.7999992370605px;">It seems as though EL2.2 support is not being added to PAX-WEB until 4.0 whereas Jahia is using 3.x.</p> <p style="line-height: 20.7999992370605px;">I may look at adding EL2.2 via a 3rd party library e.g. JBOSS-EL, and will post to this forum if i find an answer.</p>

  • Number of messages  10
    Registration date Oct 14, 2014
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page