11 Replies Latest reply on May 17, 2006 4:47 AM by francesco vivoli

    Strange behavior using JSTL (MyFaces)

    Markus Dahm Novice

      Hi,

      the following problem may not be directly linked with Seam. However,
      I'm quite confused, so maybe you can help...

      I want to to use the forEach-Tag like in the following code (dummy.jsp)

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
      
      <html>
      <head>
      <title>Dummy</title>
      </head>
      <body>
      <f:view>
       <h:outputText value="bla" />
       <h:outputText value="#{dummy.list}" />
       <c:forEach items="#{dummy.list}" var="vp">
       <div>Name: <h:outputText value="#{vp}" /></div>
       </c:forEach>
      </f:view>
      </body>
      </html>
      


      Yet the output is just:

      <html>
      <head>
      <title>Dummy</title>
      </head>
      <body>
       bla
       [Hello, World]
      
       <div>Name: </div>
      
      
      </div></body>
      </html>
      


      Notice that there are actually values in the list,
      it's just as if the c:forEach-Tag is completely ignored, while
      h:outputText works fine.

      Finally the code of the bean:

      @Stateless
      @Name("dummy")
      @Interceptors(SeamInterceptor.class)
      public class DummyBean implements Dummy {
       public List getList() {
       ArrayList<String> result = new ArrayList<String>();
       result.add("Hello");
       result.add("World");
      
       return result;
       }
      }
      


      I'm adding standard.jar to WEB-INF/lib by default. I also tried to put
      it directly into the deploy or default/lib directory or change the URI
      to http://java.sun.com/jsp/jstl/core.

      Alas, none of this worked. Do you have an idea why the above does occur?
      I've got the vague idea the #{} notation may not be appropriate, but
      ${} doesn't work.

      Cheers
      Markus