facelets - Reuse some .xhtml pages on a JSF primefaces application -


i developing simple application using jsf , primefaces , here's problem i'm facing:

these managed beans have person property:

  • clientbean
  • employeebean

i have person.xhtml shows data person. include person.xhtml on client.xhtml , employee.xhtml. need create 2 person.xhtml because i'm using different beans. want that:

<c:set var="person" value="clientbean.person" />  <ui:include src="person.xhtml"/>  <c:set var="person" value="employeebean.person" />  <ui:include src="person.xhtml"/> 

and in person.xhtml can use #{person.name} , #{person.dateofbirth}. searched , use <c:set/> in jsf wrong.

anyone can help?

pass <ui:param>.

<ui:include src="person.xhtml">     <ui:param name="person" value="#{clientbean.person}" />  </ui:include> <ui:include src="person.xhtml">     <ui:param name="person" value="#{employeebean.person}" />  </ui:include> 

register person.xhtml if necessary tag file make better, see when use <ui:include>, tag files, composite components and/or custom components?

<my:personform value="#{clientbean.person}" />  <my:personform value="#{employeebean.person}" />  

beware of duplicate component id errors. see avoiding duplicate ids when reusing facelets compositions in same naming container.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -