I have a Controller bean (SearchController) that has two managed bean as managed properties (SearchCriteria, SearchResults; both of which are session scoped).
When the user hits the find button, the action method that is executed is in SearchController.
The SearchCreteria managed bean has a method called search(). This method returns a new SearchResults object. In the controller bean, I am setting the searchResults managed property to be this new SearchResults object. The searchResults object contains what I expect during that request, but the object does not persist in the managed bean.
I understand that I am changing what object that searchResults is referencing, but what I don't understand is why JSF isn't updating the model to use the new object. Any ideas what I'm missing or don't understand? I am using JSF 1.1 on WebSphere 6.1.
If I put the search method in the SearchResults managed bean, it works.
The line in SearchController.find() that is commented out is the one that presently works.
public class SearchController {
SearchCriteria searchCriteria;
SearchResults searchResults;
ResultsBacking resultsBacking;
public String find()
{
setSearchResults(searchCriteria.search());
// searchResults.findSearchResults(searchCriteria);
if (!searchResults.resultsFound())
{
return "noresults";
}
return "success";
}
public class SearchCriteria {
public SearchResults search()
{
SearchDAO sdao = new SearchDAO();
ArrayList<Group> list = (ArrayList<Group>)sdao.findGroups(this);
SearchResults searchResults = new SearchResults();
searchResults.setSearchResults(list);
return searchResults;
}
}
public class SearchResults {
List<Group> searchResults;
public void findSearchResults(SearchCriteria criteria)
{
SearchDAO sdao = new SearchDAO();
this.setSearchResults(sdao.findGroups(criteria));
}
}