wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jstl is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jstl is not working" Watch "jstl is not working" New topic
Author

jstl is not working

MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
Hi..

my servlet code,

String [] names={"A","B","C","D"};
req.setAttribute("name",names);
RequestDispatcher view=req.getRequestDispatcher("Test.jsp");
view.forward(req,res);


jsp code:



<%@ page isELIgnored="false"%>
<html>
<body>

<table>
<c:forEach var="list" items="${name}">
<tr><td>
${list}
</td></tr>
</c:forEach>
</table>
</body>
</html>

i hav jstl.jar in the WEB-INF/lib directory

i m using tomcat5.0.16

i am getting a blank screen.

what is wrong?

Thanks


God Gave Me Nothing I Wanted<br />He Gave Me Everything I Needed<br /> - Swami Vivekananda
Ritu varada
Ranch Hand

Joined: Sep 08, 2004
Posts: 117
I think you also need standard.jar in your lib. Add that and check it out.


SCJP,SCWCD(1.4)
MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
I tried it.But the same result.

What to do?
Ritu varada
Ranch Hand

Joined: Sep 08, 2004
Posts: 117
I am not sure what you posted is the complete code but if not, have you added this taglib directive in your code ? Something like

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

Joined: Oct 09, 2003
Posts: 517
you mean i want to add
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
this in my jsp?

do i hav to make any changes in the web.xml?

Thanks
Ritu varada
Ranch Hand

Joined: Sep 08, 2004
Posts: 117
Yes, in your jsp file, preferably at the top of the page but definetely before you use the c:forEach tag.
MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
yes i did it.
Now it throws 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 this application

what does it mean?
Ritu varada
Ranch Hand

Joined: Sep 08, 2004
Posts: 117
That usually means that jstl.jar is not in the WEB-INF/lib. But, since you say it is, go to TOMCAT_HOME/work/Catalina/localhost and delete the relevant directory. Next, make sure you have the 2 jar files in your WEB-INF/lib,restart tomcat and see what the result is.
MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
Ritu,
Still it is not working.

I think the problem is with the jar file.
Anyway thank you for your help
janne s
Ranch Hand

Joined: Sep 21, 2004
Posts: 81
Hi,

I too 've same problem..EL expression is not evaluated. I'm using Tomcat5.0.19. I did put jstl.jar and standard.jar files in WEB-INF/lib.
and i didn't specify EL related tag in DD nor JSP page. Defualt EL is Enabled. How come it is not working???

I set Context InitParams in DD and in JSP file i'm tring to display with this EL exp

${initParam.admin}


any solution?
[ March 09, 2005: Message edited by: jaya m ]
MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
Hi

You hav to make some changes in the web.xml.Add this line and try.

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4">

Thanks
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
I don't have
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4">
in my web.xml and JSTL is working fine.

Put appropriate tld files to WEB-INF directory and to web.xml add


jstl.jar and standard.jar put into the WEB-INF/lib/

in jsp


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
janne s
Ranch Hand

Joined: Sep 21, 2004
Posts: 81
Thanks minu its woking now after including

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4">
[ March 10, 2005: Message edited by: jaya m ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jstl is not working
 
Similar Threads
How to use multiple forEach Loops in EL?
tags:panel not working in a particular situation
JSP column name hyperlink help
JSTL pg 437 HFSJ
Problem iterating over implicit EL header object