I have a p:datatable
, on select i want to navigate to different page. I was able to do it with <p:ajax event="rowSelect" listener="#{users.onUserSelect(userInformation.id)}"/>
public void onUserSelect(long id) {
System.out.println("user selected" + id);
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("users/user.jsf?id=" + id);
FacesContext.getCurrentInstance().responseComplete();
} catch (IOException e) {
e.printStackTrace();
}
}
in the resulting page i want to get some data from db using that ID and display it. So, first of all is this approach ok? If so how/where should i get that ID in the resulting page, using request params? or may be there is some other best practice to achieve what i want?