JSF 2.1 + Primefaces 5.3
I have a dynamic Primefaces MenuBar. The outcome="#{menuitem.link}"
is a 'page.xhtml'
<p:menubar>
<c:forEach items="#{USER_MENU_ITEMS}" var="menuitem" varStatus="status">
<p:menuitem value="#{menuitem.name}" outcome="#{menuitem.link}"/>
<c:if test="${!status.last}"><p:separator /></c:if>
</c:forEach>
</p:menubar>
All the Managed Beans are @ViewScoped
. The problem I am facing is that when I click on the menu item (that I already have worked on earlier), it navigates me to the respective page with all the data from the previous visit. I tried to append ?faces-redirect=true
but that too did not work.
header.xhtml
<ui:composition ...>
<h:form id="headerform">
<p:menubar>
<c:forEach items="#{USER_MENU_ITEMS}" var="menuitem" varStatus="status">
<p:menuitem value="#{menuitem.name}" outcome="#{menuitem.link}"/>
<c:if test="${!status.last}"><p:separator /></c:if>
</c:forEach>
</p:menubar>
</h:form>
</ui:composition>
pageB.xhtml
<html ...>
<ui:include src="./header.xhtml" />
<h:form id="pageBForm">
-- Uses pageBBean (@ViewScoped) properties and methods
</h:form>
</html>
pageA.xhtml
<html ...>
<ui:include src="./header.xhtml" />
<h:form id="pageAForm">
-- Uses pageABean (@ViewScoped) properties and methods
</h:form>
</html>