2 Replies Latest reply on Mar 26, 2008 10:46 AM by dam

    accessing an object set via ui:param in a bean

    dam

      Can I access an object set via ui:param in a bean?

        • 1. Re: accessing an object set via ui:param in a bean
          damianharvey.damianharvey.gmail.com

          Not sure if I understand you, but the way ui:param works is that you normally set it as a bean or bean property.


          eg. if I have a Bean called MyBean and use ui:include like this:


          <ui:include src="/page.xhtml">
             <ui:param name="bean" value="#{myBean}"/>
          </ui:include>



          then I can refer to MyBean in the page.xhtml as #{bean} - ie. the name of the param. So any change you make in MyBean will be available in the page via the ui:param.


          Have a read of the Facelets docs


          Cheers,


          Damian.

          • 2. Re: accessing an object set via ui:param in a bean
            dam

            Thanks


            Reading up on the facelets I can see where my misunderstanding came from


            I was trying to do something like this


            <ui:repeat value="#{page.gadgets}" var="g" >
              <ui:include src="/book/gadgets/#{g.typeName}.xhtml">
                <ui:param name="gadget" value="${g}" />
              </ui:include>
            </ui:repeat>
            



            Which isn't possible because of the different times of evaluation of the facelets tags. (I thought they were evaluated at the same time)


            This was interesting
            http://www.ilikespam.com/blog/c:foreach-vs-ui:repeat-in-facelets


            So I use the c:forEach tag instead.