Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Its still showing the same JSTL exception

 
Rajendra Nath
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...
I'm trying to execute the HFSJ JSTL example, but it's showing an exception.

for the first example of <c:forEach> example. i made a servlet, which has a an array, and i set it as an attribute at request scope. and i forwarded the request to the jsp.

In JSP, i used the taglib directive, i.e, <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core " %>

But, when i deployed and tried to exucute this application, the container is throwing an exception:

org.apache.jasper.JasperException:The absolute uri:http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with the application.

what is the solution for this exception.

And one more thing. Even i copied the standard jstl file also into my WEB-INF/lib dir.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Please tell us exactly which file are in WEB-INF/lib
2. Please also post your web.xml
 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if that doesnt work then try to putting this entry inyour web.xml

<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/lib</taglib-location>
</taglib>
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see rajendra, J2EE is all about 'alias' names

<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>- ALIAS
<taglib-location>/WEB-INF/lib</taglib-location>-ACTUAL location
</taglib>

tomorrow if you move the tld file to some other directory, none of your JSP will fail, as the alis will still point to the new location. so even this will be fine

<taglib>
<taglib-uri>rajendra<taglib-uri>- ALIAS
<taglib-location>/WEB-INF/lib</taglib-location>-ACTUAL location
</taglib>

but then in your jsp, you should use this at the top -

<%@ taglib prfix="c" uri="rajendra"%>
 
Rajendra Nath
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do i need .tld files for JSTLs. or is it enough to have jar files under WEB-INF/lib.

I did the same. i put the jar files under WEB-INF/lib, and i didn't mention anything about the uri in web.xml. because HFSJ says the container will automatically does the mapping.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am yet to touch upon that chapter
will let you know the detials once it is done !
 
dennis du
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you add exra space in the uri:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core " %>

delete it , then retry:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

This uri is located in WEB_INF / WEB-INF/sub / jar(META-INF) /jar(META-INF/sub).

the jar file should be: standard.jar
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajendra,
you only need to put the jars in WEB-INF/lib. No need to extract the TLDs.
As dennis said, check out the extra space, it may be the problem here.
 
Rajendra Nath
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's showing a different exception now.

This is my web.xml file:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">

<servlet>
<servlet-name>jstlservlet</servlet-name>
<servlet-class>com.example.JSTLServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>jstlservlet</servlet-name>
<url-pattern>/jstl</url-pattern>
</servlet-mapping>

<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/lib</taglib-location>
</taglib>

</web-app>

and

This is the exception the container is throwing now

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: File "/WEB-INF/lib" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:202)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:460)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:525)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1625)
org.apache.jasper.compiler.Parser.parse(Parser.java:173)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:243)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.example.JSTLServlet.doGet(JSTLServlet.java:17)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.


Thanks a lot for your kind response.

Bye...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to declare the location of the taglib, as the container will do it for you. So remove the <taglib> tag in your web.xml.
 
Rajendra Nath
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's stl showing the same exception
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic