Reputation: 129
I am trying to pass parameter between two pages.my User.xhtml page has ui:repeat which displays user.I have access to the user Id as well. I want to click on the user and go to their details page. I have userDetails.xhtml which is blank at the moment.
I have a Bean as well.
Currently I am using h:link to navigate one page to another. And it works.
My mission is : Click on the user and get their details.
Please help, I am pretty new in JSF
Thanks
Upvotes: 4
Views: 14016
Reputation: 9266
You can try using <f:param>
:
<ui:repeat value="#{userBean.users}" var="u">
...
<h:link outcome="userDetails" value="Details">
<f:param name="userID" value="#{u.id}" />
</h:link>
...
</ui:repeat>
then you can get the id like this:
@ManagedBean
@RequestScoped
public class UserDetailsBean {
@ManagedProperty(value = "#{param.userID}")
private String userID;
// Getters and Setters
}
Upvotes: 6