6 Replies Latest reply on Sep 23, 2006 5:36 AM by Jim Hazen

    JSTL tags ignored

    flo thomas Newbie

      Hi,
      when I have jstl-core tags like <c:if test...> in my view, they are outputted without being processed, i.e. I actually find the <c:if test...> tag in the rendered page, however the test-case is evaluated (i.e. it says false or true).

      I ensured that the jstl-tags are "registered" in the ui:composition.

      I know that the <h:outputText rendered="condition"/> allows similar things, but the jstl is just more flexible... what am I doing wrong?

      Thanks

        • 1. Re: JSTL tags ignored
          Gavin King Master

          I guess jstl.jar is not in the classpath, or perhaps you have not defined the c: namespace in your jsp/facelets template.

          • 2. Re: JSTL tags ignored
            Jim Hazen Expert

            Also, make sure that namespace is correct. Facelets supports limited JSTL functionality (including c:if), but you need to be sure and use the http://java.sun.com/jsp/jstl/core namespace, not the earlier JSTL 1.0 namespace.

            • 3. Re: JSTL tags ignored
              Richard Doust Newbie

              Have you resolved this problem yet? I'm experiencing something similar, only I'm not using Seam. Just standard jsp pages with JSTL. Tomcat is ignoring them.

              • 4. Re: JSTL tags ignored
                Jim Hazen Expert

                Ran into this problem again today. Turns out the proper namespace is xmlns:c="http://java.sun.com/jstl/core". At least with the version of facelets I'm using 1.1.5.

                • 5. Re: JSTL tags ignored
                  Denis Karpov Newbie

                  It is hot topic on faselets forum. Specially <c:if? case. Your mistake is you are trying to use build-time tag as render-time.
                  For instance, instead of <c:if> almost always you should use rendered attribute.

                  .........
                  Why doesn't my c:if / ui:repeat / ui:include work properly?
                  You're probably using a bad combination of build-time and render-time tags. For example, c:if is a build-time tag, so any EL expressions are only evaluated once (when the tree is built), even if you put it inside a ui:repeat or h:dataTable. Conversly, since ui:repeat is a 'render-time tag' (i.e. a UIComponent), you can't use it to iterate over build-time tags such as f:selectItem.

                  Build-time (facelet) tags:
                  · all JSTL tags (e.g. c:if, c:forEach, c:choose)
                  · all ui tags except ui:repeat (e.g. ui:include, ui:decorate, ui:composition)
                  · all core faces tags except f:verbatim (e.g. f:validator, f:convertNumber, f:selectItem)

                  Render-time tags (UIComponents):
                  · all UIComponent tags (e.g. ui:repeat, h:inputText, t:saveState)
                  http://wiki.java.net/bin/view/Projects/FaceletsFAQ#Why_doesn_t_my_c_if_ui_repeat_ui

                  • 6. Re: JSTL tags ignored
                    Jim Hazen Expert

                    I'm pretty sure we were both using JSTL correctly, but had the wrong namespace. If you don't specify the proper namespace facelets will happily just spit out your tag as text instead of performing the appropriate taglib processing. This is the problem we both had, and it's solved by using the above namespace.

                    That's not to say that other problems with EL, JSTL and Faclets aren't possible. I just don't think we experienced them here.