4 Replies Latest reply on Jun 26, 2008 6:20 PM by Damian Harvey

    facelets ui:composition

    Ale Fred Newbie

      facelets' ui:composition tag doesen't allow an EL expression on the template attribute, preventing the creation of a dynamic templating mechanism.
      Is there a way to get around that?
      Does anybody know if is there any plan to add such a functionality?
      Thanks.

        • 1. Re: facelets ui:composition
          Mikael Andersson Master

          ui:composition with EL works for me.


          Just tested the following simple test:


          with a req param called page with the value /WEB-INF/layout/template.xhtml


          <ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                    xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                    xmlns:s="http://jboss.com/products/seam/taglib"
                    template="#{param.page}">
                          
          
                  <ui:define name="body">
                          #{param.page}
          


          • 2. Re: facelets ui:composition
            Ale Fred Newbie

            I'm sorry.
            The ui:insert only supports literals :



            17:45:54,531 ERROR [STDERR] com.sun.facelets.tag.TagAttributeException: /components/insert.xhtml @9,51 <ui:ins
            ert name="#{element.attributes.name}"> Must be Literal



            any way to get around?

            • 3. Re: facelets ui:composition
              Mikael Andersson Master

              I've got nothing, sorry.


              To me it feels a bit strange to use a dynamic name for the ui:insert, curious about your usecase.

              • 4. Re: facelets ui:composition
                Damian Harvey Apprentice

                Try using the richfaces include:


                <a4j:include viewId="#{element.attributes.name}"/>
                


                Cheers,


                Damian.