2 Replies Latest reply on Jan 22, 2007 4:46 AM by rsmol

    Seam and JSTL

    rsmol

      Hi,
      I'm still quite new to SEAM and Java coding at all. Is there anything specific needed to setup Seam with JSTL? I use Facelets as recommend in the book and reference manual.

      page.xhtml

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:c="http://java.sun.com/jsp/jstl/core"
       template="layout/template.xhtml">
      <ui:define name="body">
      
       <c:if test="true">
       Generate this template text if s "true"
       </c:if>
       <c:if test="false">
       Generate this template text if s "false"
       </c:if>
      </ui:define>
      </ui:composition>


      Produces:
      Generate this template text if s "true" Generate this template text if s "false"


      Source of rendered HTML page:

      <c:if test="true">
      Generate this template text if s "true"
      </c:if>
      <c:if test="false">
      Generate this template text if s "false"
      </c:if>

      I guess the code is just copied to output and not processed by JSTL? I'm using seam-gen to generate project and so far I've only modified build.xml to copy jstl-1.1.0.jar to WEB-INF/lib of app.war. I've also tried to substitute "true" with "#{true}" and "${true}", not sure if that matters. JBOSS server output did not tell anything suspicious. Any hints?

      Best regards



        • 1. Re: Seam and JSTL
          pmuir

          Try

          xmlns:c="http://java.sun.com/jstl/core"


          With facelets it's recommended not to use JSTL except if you really need to and you understand how it will interact with facelets. Certainly for the above you would be much better off using the rendered attribute

          • 2. Re: Seam and JSTL
            rsmol

            After reading Facelets API, Ifound it is supposed to support IF tag. Then I checked dvdstore example and found I was using wrong namespace definition (I copied it from somewhere in the internet). Now it is working very fine.

            xmlns:c="http://java.sun.com/jstl/core" is the right namespace
            not xmlns:c="http://java.sun.com/jsp/jstl/core" as I had previously.

            Thank you for quick reply and for SEAM examples, they are great source!