Issue
I am working on a dynamic web project in Eclipse Kepler. I am trying to write a simple JSP using JSTL <c:forEach>
. For that I have included the required JAR jstl-1.2.jar
under libraries and added the following statement to JSP:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
However, when I run it using Run as --> Run on Server, it shows the following error.
org.apache.jasper.JasperException: /test.jsp(4,61) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
I have already consulted a lot of links, but I don't understand how this is caused and how I can solve it.
Solution
For that I have included the required JAR jstl-1.2.jar under libraries
This makes it only available during compile time, not run time.
You need to undo everything which you did in project's Build Path and Deployment Assembly properties. If you're not sure anymore what changes you've all done over there, then throw away the current project and recreate the project from scratch and remember to never touch the project's Build Path and Deployment Assembly properties until you really really understand what it is doing under the covers (in other words, when you're able to create, build and deploy a WAR from top of head in command prompt without using any IDE).
The proper procedure is:
- Open the project's
WebContent/WEB-INF/lib
folder. - Drop the
jstl-1.2.jar
file in there.
That's it. Nothing more needs to be done. No need to fiddle anywhere in project's properties. Eclipse will automatically do the necessary magic there.
See also:
Update: as per the comments,
web.xml is declared to version 2.4 and I am using Basic Server: J2EE Preview at localhost
There's the cause of your problem. JSTL 1.2 requires a minimum of Servlet 2.5 and "J2EE Preview" is completely outdated. Grab Tomcat 7 (pick the core ZIP file), extract it, integrate it in Eclipse, add the project to Tomcat, fix your web.xml
to be Servlet 3.0 compatible, then start Tomcat and enter the desired URL in your favourite webbrowser.
Answered By - BalusC