aspose file tools*
The moose likes JSP and the fly likes JSTL killing me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL killing me" Watch "JSTL killing me" New topic
Author

JSTL killing me

sandeep kumar jangra
Greenhorn

Joined: Jan 12, 2005
Posts: 29
hi everybody, I m new to JSP and trying to use JSTL. I hv downloaded the jakarta-taglibs-standard-1.0-20050120 zip file from net and I m using tomcat4.1.31.
below is my jsp file which i used:
---------------------------------------------
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>

<html>
<head>
<title>using tlds</title>
</head>

<body>
you sent the following headers
<p/>
<table border="1">
<tr>
<th>
HEADERS
</th>
<th>
values
</th>
</tr>
<c:forEach var="entry" items="${header}">
<tr>
<td>
${entry.key}
</td>
<td>
${entry.value}
</td>
</tr>
</c:forEach>
</table>
</body>
</html>
---------------------------------------------------

I copied the jar files from the lib folder of taglibrary and pasted them in my WEB-INF/lib and copied the c.tld in WEB-INF

but when I run my program it shows exception
----------------------------------------------------

org.apache.jasper.JasperException: This absolute uri (http://java.sun.com/jstl/core_rt) cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:60)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:385)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:109)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:116)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:309)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:336)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:750)
at org.apache.jasper.compiler.Parser.parse(Parser.java:77)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:157)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:111)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:183)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:445)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

--------------------------------------------------------

searched all the forums and tried everything kindly help
louise rochford
Ranch Hand

Joined: Apr 04, 2002
Posts: 119
For pre-J2EE 1.4 containers I belive you have to put a x-reference in the web.xml file. (In J2EE 1.4 containers, the container knows where to look for tlds so you don't have to. I'm guessing the Tomcat 4.1 is J2EE 1.3 compliant)

Stick something like:

<taglib>
<taglib-uri>/WEB-INF/coreTags</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

...in your web.xml, just before the closing </web-app> tag
& change the uri in the page to /WEB-INF/coreTags. (It might be possible to use the value you already have in the page - have a play round & see what works)
sandeep kumar jangra
Greenhorn

Joined: Jan 12, 2005
Posts: 29
thank you louise rochford that worked. I was very troubled by that n was unable to get any answers. but I have one more problem though the output screen showed up but the output of the tag given below was a series of
${entry.key} ${entry.value}
${entry.key} ${entry.value}
${entry.key} ${entry.value}
${entry.key} ${entry.value}
${entry.key} ${entry.value}
${entry.key} ${entry.value}

------------forEach tag----------------
<c:forEach var="entry" items="${header}">
<tr>
<td>
${entry.key}
</td>
<td>
${entry.value}
</td>
</tr>
</c:forEach>
----------------------------------------
can u please explain that.
and thanx once again.

Sandeep
louise rochford
Ranch Hand

Joined: Apr 04, 2002
Posts: 119
Hi Sandeep,
Do you mean that its just printing out ${entry.key} ${entry.value} as many times as there are items in ${header}? i.e. its not recognising the ${entry.key} ${entry.value} as EL & interpreting it?

If so, I think I've had the same problem when using a J2EE1.3 compliant container - its a version support problem again.
Proper EL support came in with JSP2.0 / J2EE1.4 & you're working with JSP1.2.
For some reason, it can cope with EL in some places like the tag attribute items, but not within the body of the tag.

I managed to get this to work by sticking the EL inside a cut
- I don't understand why this works but it does - if you figure it out, please explain it to me.
ie.


best wishes,
Louise
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSTL killing me