22 Dec 2011

JSTL library problem

i was creating a web application on  the Eclipse IDE using the GlassFish server.when i trying to use the JSTL library by 
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"  %> in my jsp file.
But what i get is 
org.apache.jasper.JasperException:According to TLD or attribute directive in tag file, attribute value does not accept any expressions.


The root cause of the error is that the JSTL's uri is incorrect for the used jsp version.

Make Correct use of Library :
1. Check the servlet version and refer to it in the Deployment Descriptor(web.xml) of web application.
<?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_3_0.xsd" id="WebApp_ID" version="3.0">

2. Refer correct JSTL uri for the servlet or jsp.
servlet_2.3 or jsp_1.2 => JSTL_1.0 (JSTL uri =http://java.sun.com/jstl/core)
servlet_2.4 or jsp_2.0 => JSTL_1.1 (JSTL uri =)http://java.sun.com/jsp/jstl/core
servlet_2.5 or jsp_2.1 => JSTL_1.2 (JSTL uri =http://java.sun.com/jsp/jstl/core

)

No comments:

Post a Comment