I have 2 JSF pages(page1 and page2 for example).The first one represents table with users data.
<h:dataTable value="#{dataBean.collection}" var="contact">
<h:column>
<f:facet name="header">
First name
</f:facet>
<h:outputText value="#{contact.firstName}"/>
</h:column>
<h:column>
<f:facet name="header">
Last Name
</f:facet>
<h:outputText value="#{contact.secondName}"/>
</h:column>
<h:column>
<f:facet name="header">
Phone
</f:facet>
<h:outputText value="#{contact.phone}"/>
</h:column>
<h:column>
<f:facet name="header">
Details
</f:facet>
<h:button outcome="#{dataBean.doSomeMagic(contact)}" value="Detailed info" />
</h:column>
</h:dataTable>
So, when we click "Detailed info" button we should be redirected to page2 which shows detailed info about current user.The question is what is the best way to organize data tranfer between these two pages.I tried to develop some method("doSomeMagic") which saves bean state and returns String for navigation rule, but I always get there user from last row of the table.
public String doSomeMagic(UserBean userBean){
beanToDisplay = userBean;
return "user";
}
Page2 shows info from beanToDisplay fields. I do not wanna to reinvent the wheel and want to know basic ways to solve this task.Thank you for your reply!