Question

Suppose I have a left hand side panel and I want to change the forms in another panel based on the event of components on left panel. How can I do it in JSF?

I searched a little bit and found that tabView in primefaces can do something like this. But I would like to know whether there is another way of changing contents of another panel from some event of one panel.

I understand that this question is not quite specific but I searched on google and couldn't find satisfactory answer so asking here.

Thanks for the help :)

Était-ce utile?

La solution

1. You have some context in center:

Left:

<p:commandButton update="pncenter" actionListener="#{bean.update}"/>

Center:

<p:outputPanel id="pncenter">
<p:outputPanel id="pn1" rendered="#{bean.render eq '1'}">
  // content here
</p:outputPanel>
<p:outputPanel id="pn2" rendered="#{bean.render eq '2'}">
  // content here
</p:outputPanel>
///....
</p:outputPanel>

2. You have dynamic center:(Each center context is stored in a xhtml file)

Left:

<p:commandButton update="pncenter" actionListener="#{bean.update}"/>

Center:

<p:outputPanel id="pncenter">
  <ui:include src="#{centerBean.link}"/>
</p:outputPanel>

bean.update method

centerBean.link = "/module/test1.xhtml"; // /module/test2.xhtml  /module/test3.xhtml
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top