Showing posts with label JSTL TAGS. Show all posts
Showing posts with label JSTL TAGS. Show all posts

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.

SPRING & MAVEN - Get JSTL and Standard Jars from Maven

In early times, Sun Jars were not available on the central maven repository and people have to go through the tedious process to add the jars manually to their local repository. But the Sun Jar files are now available available in the central maven repository itself and can be referred directly in the pom.xml file.

Samples:

<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>