3 Replies Latest reply on Aug 18, 2005 10:58 AM by panu viljamaa

    JSTL <c:forEach>

    wade wang Newbie

      I tried the following simple jsp with Jboss4.0.2 and JSTL 1.1.2:

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

      I saw the ...${i} ${i} ${i} ${i} ${i} ...... on the page.

      What's going on. I tried it with own tomcat5 it worked.

      Thanks in advance,

        • 1. Re: JSTL <c:forEach>
          panu viljamaa Newbie

          I had the same problem. However what seemed to help was that I

          1. Put the following into the WEB-INF\web.xml :

          <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"

          2. Stopped the server
          3. Deleted server\default\tmp -work and -log
          4. Restarted the server

          I don't see a good reason why it should be this difficult, but so it seems. Good luck for you.

          • 2. Re: JSTL <c:forEach>
            wade wang Newbie

            Thanks for the reply. Yes, you are absolutely right. However it does not completely solve my problem. I was using JBoss IDE to create a JSP page template each time when I created a new JSP page. JBoss IDE always adds the following at the beginning of the new JSP page:

            <%@page contentType="text/html" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            Somehow this causes the expression not evaluated. After I delete these pre-generated lines. It works.


            • 3. Re: JSTL <c:forEach>
              panu viljamaa Newbie

              I think the recommended way is to add this to the top of the page:
              <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

              So if JBossIDE puts some other %@ directive there, it may get confused. If you take them out alltogether and it still works, great. So it seems JBossIDE is not quite up-to-date. I'd hope that the Eclipse WebToolsProject has good support for JSTL, haven't checked it yet.