Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL tags not recognized

 
Rajani Deshpande
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: <cut value="${now}"/></h5></p>

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

<cut 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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
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">
<cut 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
Author and ninkuma
Marshal
Pie
Posts: 65218
95
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
Author and ninkuma
Marshal
Pie
Posts: 65218
95
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
Author and ninkuma
Marshal
Pie
Posts: 65218
95
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic