• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

JSTL tags not recognized  RSS feed

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a simple JSP page

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

<%String s= "Testing JSP";
out.println(s);
out.println("Hey this worked");
%>

<jsp:useBean id="now" class="java.util.Date" />
<p><h5>Last Updated on: <c:out value="${now}"/></h5></p>

Setting the value: "Hello World!"
<c:set var="hello" value="Hello World!"/>
<p/>

<c:out value="${hello}"/>

I have the tld files in web-inf/tld and accordingly defined in web.xml
it doesnt give any error but , it prints ${now} and ${hello} literally..

what am i missing?
Thanks
 
Marshal
Posts: 67164
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need to know what container you are using and its version. Tomcat 4? Tomcat 5? Other?
 
Rajani Deshpande
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually, it does reqcognize the c:foreach, but not c ut..
I tried this and this prints ${i} 10 times !

<c:forEach var="i" begin="1" end="10" step="1">
<c:out value="${i}" />
<br />
</c:forEach>

what am i missing?

[ January 12, 2006: Message edited by: Rajani Deshpande ]
[ January 12, 2006: Message edited by: Rajani Deshpande ]
 
Rajani Deshpande
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using tomcat 5
 
Bear Bibeault
Marshal
Posts: 67164
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Tomcat 5, you are using the wrong version of the JSTL. The URI you gave is for JSTL 1.0. You need JSTL 1.1.
[ January 12, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Marshal
Posts: 67164
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this JSP FAQ for details.

Also be sure that your web app is properly declared in the web.xml according to this other JSP FAQ.
[ January 12, 2006: Message edited by: Bear Bibeault ]
 
Rajani Deshpande
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using jstl 1.1 and i changed the uri to
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

but still no luck...???
 
Rajani Deshpande
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a bunch for the prompt replies!
It worked! I had to change web.xml too.
 
Bear Bibeault
Marshal
Posts: 67164
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Rajani Deshpande:
Thanks a bunch for the prompt replies!
It worked! I had to change web.xml too.



You're welcome. Yes, without the web.xml change, Tomcat does not "turn on" the EL.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!