I am developing a CMS using JSF 2.3. I need to pass a GET parameter to every page indicating the site that the user is managing. To do this I am using <f:viewParam>
in all pages, but I have the following doubts:
- Is it OK to use multiple
<f:viewAction>
for multiple managed beans like the following example?
<f:metadata>
<f:viewParam name="form" value="#{editFormWebBean.formIdParam}"/>
<f:viewParam name="site" value="#{headerWebBean.siteIdParam}"/>
<f:viewAction action="#{editFormWebBean.init}" />
<f:viewAction action="#{headerWebBean.init}" />
</f:metadata>
This works, but I am not sure if it is OK.
- Is there a way to avoid replicating in every page the
<f:viewParam>
for the site parameter? I tried with includeViewParams, but doesn't worked if I don't include the<f:viewParam>
in the source and destination page (from page1.xhtml to page2.xhtml)
3) Can I define multiple <f:metadata>
tags? For example if I am using templates and multiple ManagedBeans pare page (one for the header, one for the menu and so on).
Thank you and sorry about my english.