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

JSTL Problem

Vic Newman
Ranch Hand

Joined: Mar 01, 2002
Posts: 33
I am using tomcat 5.5 and jstl 1.1 (2.0). I am having a problem with the following code

<jsp:useBean id="values" type="java.util.List" scope="request"/>

<html>
<head>
<title> title goes here</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<table width="100%" border="0" class="fieldlabel">
<tr> Cruise lines </tr>

<c:forEach items="${values}" var="value" varStatus="status">
<c:if test="${status.first}"> first </c:if>
<c:if test="${status.last}"> last </c:if>
<tr><td>zz<cut value="${value}" default="no value available"/></tr></td>
</c:forEach>

<c:forTokens items="a;b;c;d" delims=";" var="current">
<tr><td><cut value="${current}"/></td></tr>
</c:forEach>

</body>
</html>


Nothing prints for c:forEach of c:forTokens

when I do a view source when the jsp is rendered in the browser I see the following:

<table width="100%" border="0" class="fieldlabel">
<tr> Cruise lines </tr>

<c:forEach items="[one, two, three]" var="value" varStatus="status">
<c:if test=""> first </c:if>
<c:if test=""> last </c:if>
<tr><td>zz<cut value="" default="no value available"/></tr></td>
</c:forEach>

<c:forTokens items="a;b;c;d" delims=";" var="current">
<tr><td><cut value=""/></td></tr>
</c:forEach>

</body>
</html>



I see the values in the items but they do not print. What stupid thing am i doing wrong?

Thanks
Vic Newman
Ranch Hand

Joined: Mar 01, 2002
Posts: 33
Never mind folks. As soon as you post a silly question you find the answer yourself. Missing tag lib in web.xml. arggggggggggghhhhhhh! I'm out!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Originally posted by Vic Newman:
Missing tag lib in web.xml.


Actually, you should not need the taglib element in the web.xml.

All you need to do is include the appropriate taglib directive on the page with the appropriate URI to the JSTL.

Less is more -- why put declarations in the web.xml if you don't have to?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Prasad Babu
Ranch Hand

Joined: Jul 17, 2005
Posts: 57
Hi Vic Newman,

Once again check your useBean tag in your JSP page. there is no information regarding Class type. you simply type as java.util.List. then how JSP will get data?

With regards,
Prasad
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Originally posted by Prasad Babu Dandu:

Once again check your useBean tag in your JSP page. there is no information regarding Class type. you simply type as java.util.List. then how JSP will get data?


What Vic has done in this regard is perfectly sensible. Moreover, this doesn't really have anything to do with the question he asked.
[ March 23, 2006: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL Problem