I have a managed bean called UserSearchHandler
, it has a doSearch
method that populates UserSearchHandler.searchResults
which are displayed in a table on the userSearch.xhtml
page.
I have another managed bean called UserHandler
, it has a showUser
method and so on.
In the search results table, the user name is a link that, when clicked, is supposed to show user details on a userView.xhtml
page. The table and link looks like this:
<p:dataTable var="user" value="#{userSearchHandler.searchResults" >
// ... and so on ... then
<h:commandLink value="#{user.firstName}" action="#{userHandler.showUser}">
<f:setPropertyActionListener target="#{userHandler.userIdToShow}" value="#{profile.id}"/>
</h:commandLink>
Everything works fine when the managed beans are set to session
scope.
However, when I change the scope on the beans to request
, the search works and the table gets populated, but when I click on the name link nothing happens. I put a break point on the userHandler.showUser
method and it never gets hit when the userSearchHandler
is set to "request" scope.
Can anyone help explain why this is, or what I'm doing wrong?