Girish
Girish

Reputation: 191

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 ?

Upvotes: 3

Views: 5501

Answers (2)

Hlex
Hlex

Reputation: 971

Check this : https://www.ibm.com/developerworks/community/forums/html/topic?id=869d42f2-6ef6-4708-b5fd-dec19afe1f03&ps=25

They believe that webpshere not allow to run jsp inside web-inf

Upvotes: 0

BalusC
BalusC

Reputation: 1109222

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:

Upvotes: 1

Related Questions