2 Replies Latest reply on Mar 14, 2008 4:33 PM by h b

    A design/reusability question

    h b Newbie

      Hello, I'm new to JSF, Facelets and Richfaces :-) So far I'm very impressed with Richfaces. I've run into a coding problem, and was hoping to hear you suggestions:
      I'm building a page that will have many TogglePanels in it. I'd like the togglepanels to behave the same way (same set of states, same state order, width height, same css styles, etc.), except the content for each TogglePanel will be different. Here is how I went about doing this:
      * I built one of my sections with the togglepanel.
      * Put it in a jsf (myTogglePanel.jsf) file then I can include it anywhere I want.
      * Taking advantage of the ui:include/ui:param in facelets, I sent parameters into the toggle panel to set its title, etc.
      * Something like this:

      <ui:include src="myTogglePanel.jsf">
       <ui:param name="p1" value="v1"/>
       <ui:param name="contentForState1" value="v2"/>
       <ui:param name="contentForState2" value="#{myBean.prop2}"/>
      </ui:include>


      So far it works great. Where it breaks is that, sometimes the content for a particular state needs to be a table (rich:dataTable). It would be really cool if I could do something like this:
      <ui:include src="myTogglePanel.jsf">
       <ui:param name="p1" value="v1"/>
       <ui:param name="contentForState1" value="v2"/>
       <ui:param name="contentForState2"/>
       <rich:dataTable ...>
       ...
       </rich:dataTable>
       </ui:param>
      </ui:include>


      But I can't is there a nice way around this? Do I have to write my own custom jsf component? Otherwise I'd have to copy paste the content of myTogglePanel.jsf all over the place and just change its content.

      Thanks