Reputation:
Both pages contains the header:
<p:tabMenu activeIndex="#{param.i}">
<p:menuitem value="Overview" outcome="index" icon="ui-icon-star">
<f:param name="i" value="0" />
</p:menuitem>
<p:menuitem value="Demos" outcome="second" icon="ui-icon-search">
<f:param name="i" value="1" />
</p:menuitem>
</p:tabMenu>
The second page contains a form:
<h:form>
<h:inputText id="name" value="#{name}" a:placeholder="What's your name?" />
<h:commandButton value="Submit" outcome="second" />
<br/> <h:outputText value="Hello, #{name}" rendered="#{not empty name}" />
</h:form>
The problem is that activeIndex becomes 0 after the form submited. How to fix it?
Upvotes: 1
Views: 186
Reputation: 12337
I personally use a @ViewAccessedScope
for menu backingveans from DeltaSpike for this instead of passing params around.
Upvotes: 0
Reputation:
it fixed by adding a <f:param name="i" value="1" />
to commnadButton
Upvotes: 2