JSF: bean scope; session vs request

后端 未结 2 1217
终归单人心
终归单人心 2020-12-30 15:09

I have a managed bean called UserSearchHandler, it has a doSearch method that populates UserSearchHandler.searchResults which are disp

2条回答
  •  爱一瞬间的悲伤
    2020-12-30 15:29

    That's because the #{userSearchHandler.searchResults} is empty during the new request and therefore JSF is unable to locate the associated row where the commandlink is been invoked in order invoke the action (and to pass/set properties if any).

    You need to ensure that the same #{userSearchHandler.searchResults} is precreated during bean's construction/initialization. If it's to be created based on a specific set of parameters, then you've to pass them along with the form as well.

    That's exactly the reason why solutions like Tomahawk's and new JSF 2.0 view scope exist.

    See also:

    • What are the main disadvantages of JSF 2.0?

提交回复
热议问题