Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jstl el function error on websphere

I am using a similar conditional check using JSTL in a jspx file

<jsp:root version="2.0" 
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions">  

    <c:choose>
    <c:when test="${fn:startsWith(check.defApplication, 'Mail')}">
    <c:set var="mySet" value="messages"/>
    </c:when>
    <c:otherwise>
    <c:set var="mySet" value="messagesagain"/>
    </c:otherwise>
    </c:choose>

but its throws the error

Unable to locate the el function startsWith in the tld with uri http://java.sun.com/jsp/jstl/core

The el function is defined for uri http://java.sun.com/jsp/jstl/functions but still it gives the wrong uri in the error message. I changed the order in the uri declarations, but the error message remained the same.

The uri is properly defined in web.xml. The above code works perfectly fine on tomcat, but gives error on Websphere 7.0.0.19.

Any idea what might be going wrong ?

like image 754
Girish Avatar asked Feb 19 '26 21:02

Girish


1 Answers

I'm not sure about the real cause of the problem. However the following statements indicates that something is not entirely right:

The uri is properly defined in web.xml.

You should not define them in your web.xml. Just having the JAR file in runtime classpath ought to be sufficient. In case, you should also not have extracted the JSTL JAR file(s) and put its loose contents around in your webapp's /WEB-INF.


The above code works perfectly fine on tomcat, but gives error on Websphere 7.0.0.19.

Websphere ships with its own JSTL library. This conflict indicates that you've dropped the JSTL JAR file(s) in webapp's /WEB-INF/lib. You'd like to remove them and put them in Tomcat's own /lib folder.

See also:

  • Our JSTL wiki page
like image 154
BalusC Avatar answered Feb 21 '26 14:02

BalusC