You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Wali Ansary <an...@hotmail.com> on 2004/05/06 20:21:53 UTC

Problem with JSTL 1.1 and Tomcat 5 (JWSDP 1.3)

Hi,

I've used JSTL 1.0 before, and am trying to write a little app in 1.1 now. 
I'm using the Tomcat that I got with JWSDP 1.3 (which is v 5). The examples 
that come with WSDP work, but when I'm trying to write something on my own, 
or even copy the same code to a page of my own, it doesnt work. Here is the 
sample code:

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

<html>

<body>

<c:forEach var="i" begin="100" end="200" step="5" varStatus="status">
  <c:if test="${status.first}">
    begin:<c:out value="${status.begin}">begin</c:out> &nbsp; &nbsp;
      end:<c:out value="${status.end}">end</c:out> &nbsp; &nbsp;
     step:<c:out value="${status.step}">step</c:out><br>
    sequence:
  </c:if>
  <c:out value="${i}"/>
  <c:if test="${status.last}">
    <br>There are <c:out value="${status.count}"/> numbers in the list.
  </c:if>
</c:forEach>

</body>
</html>


It gives me the following:

${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} 
${i} ${i} ${i} ${i} ${i} ${i}

BTW, I have the jars in the WEB-INF/lib; the same jars that the examples are 
using. Please HELP!

Wali

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Problem with JSTL 1.1 and Tomcat 5 (JWSDP 1.3)

Posted by Kris Schneider <kr...@dotech.com>.
Make sure you're using a Servlet 2.4 web.xml. If you're using a Servlet 2.3
web.xml, then the only RT expression that will get evaluated is a JSP
expression (<%= ... %>). An EL expression will be treated as a literal string,
hence all the "${i}" output. Of course, if your app also needs to work with
Servlet 2.3 / JSP 1.2, then keep the Servlet 2.3 web.xml and use JSTL 1.0
instead of 1.1.

Quoting Wali Ansary <an...@hotmail.com>:

> Hi,
> 
> I've used JSTL 1.0 before, and am trying to write a little app in 1.1 now. 
> I'm using the Tomcat that I got with JWSDP 1.3 (which is v 5). The examples 
> that come with WSDP work, but when I'm trying to write something on my own, 
> or even copy the same code to a page of my own, it doesnt work. Here is the 
> sample code:
> 
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> 
> <html>
> 
> <body>
> 
> <c:forEach var="i" begin="100" end="200" step="5" varStatus="status">
>   <c:if test="${status.first}">
>     begin:<c:out value="${status.begin}">begin</c:out> &nbsp; &nbsp;
>       end:<c:out value="${status.end}">end</c:out> &nbsp; &nbsp;
>      step:<c:out value="${status.step}">step</c:out><br>
>     sequence:
>   </c:if>
>   <c:out value="${i}"/>
>   <c:if test="${status.last}">
>     <br>There are <c:out value="${status.count}"/> numbers in the list.
>   </c:if>
> </c:forEach>
> 
> </body>
> </html>
> 
> 
> It gives me the following:
> 
> ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} 
> ${i} ${i} ${i} ${i} ${i} ${i}
> 
> BTW, I have the jars in the WEB-INF/lib; the same jars that the examples are
> 
> using. Please HELP!
> 
> Wali

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org