[jboss-user] [JBoss Seam] - ui:insert and setting values

EricJava do-not-reply at jboss.com
Sun Feb 3 12:26:17 EST 2008


Simple question: I'm defining a template which I want to display one of the defined items twice.  For example, here's what the template looks like:

<ui:composition>
  |   <h2>Here it is the first time:</h2>
  |   <ui:insert name="groupA"/>
  |   <h2>And now we see it again:</h2>
  |   <ui:insert name="groupA"/>
  | </ui:composition>

And that works correctly.  Next step, I would like to have different settings within the template when I run it the second time.  For example:

The file using the template:
(Some stuff)
  | 
  | <ui:decorate template="/my-template.xhtml">
  | 
  |   <ui:define name="groupA">
  |     This content shows up always!
  | 
  |     <s:div rendered="{showFirstTime}">
  |       This div will show only when showFirstTime is true
  |     </s:div>
  | 
  |     <s:div rendered="{showSecondTime}">
  |       This div will show only when showFirstTime is true
  |     </s:div>
  |   </ui:define>
  | </ui:decorate>
  | 
  | (some more stuff)

Then I would like to make the template look like this:

<ui:composition>
  |   <h2>Here it is the first time:</h2>
  | 
  |   <ui:insert name="groupA">
  |     <ui:param name="showFirstTime" value="#{true}"/>
  |     <ui:param name="showSecondTime" value="#{false}"/>
  |   </ui:insert>
  | 
  |   <ui:insert name="groupA">
  |     <ui:param name="showFirstTime" value="#{false}"/>
  |     <ui:param name="showSecondTime" value="#{true}"/>
  |   </ui:insert>
  | 
  |   <h2>And now we see it again:</h2>
  |   <ui:insert name="groupA"/>
  | </ui:composition>

But that doesn't work.  The value set by ui:param doesn't show up.

Any ideas on how to do this?  I'm obviously missing something with Facelets here.  Is there some tag to set a value in the page context?  That seems like what I want to do, but <ui:param> (and f:param) don't do it.

Thanks


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125864#4125864

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4125864



More information about the jboss-user mailing list