Wednesday, July 6, 2011

JSTL tags not working on JSP?

Whenever I try to display the request attributes using the JSTL tag (<c:out value="${data}" />), all I get was the variable itself getting displayed in the output. I was able to fix the problem after I provided proper header version detail in the web.xml file.

Sample JSP:
<c:out value="${userName}"></c:out>

Sample Web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
id="WebApp_ID" version="2.5">
</web-app>


With the above version change to the web-app element in web.xml, everything started working fine.

No comments:

Post a Comment