• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

jstl is not working

 
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you also need standard.jar in your lib. Add that and check it out.
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried it.But the same result.

What to do?
 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 517
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, in your jsp file, preferably at the top of the page but definetely before you use the c:forEach tag.
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 517
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ritu,
Still it is not working.

I think the problem is with the jar file.
Anyway thank you for your help
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 517
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
janne s
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Tell me how it all turns out. Here is a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic