jsf passing parameters in a method expression failes in ViewScoped bean

后端 未结 1 908
一生所求
一生所求 2021-01-26 11:37

I have jsf page backed by a ViewScoped bean which lists a bunch of transactions like below



        
相关标签:
1条回答
  • 2021-01-26 12:34

    That will happen when the #{transactions_byaccount.pageList} has incompatibly changed during processing of the form submit as compared to how it was during displaying the form.

    During the new HTTP request of processing the form submit, JSF will reiterate over it to find the action invoked and to prepare the #{item} in order to pass it. Note that this is thus not prepared during the HTTP request of rendering the HTML form for display.

    This problem indicates that you're initializing #{transactions_byaccount.pageList} based on an outdated (or a too new) variable which caused it to incompatibly change. You should not do that. You should rewrite your bean logic as such that it initializes on postback exactly the same list as it was during display and then change it only when the action has actually been invoked (thus, inside the action method).

    Given that you're using a view scoped bean, you should actually already be set as it actually remembers all properties for subsequent requests. Perhaps you're performing initialization in the getter method of the list. You should not be performing business logic in getter methods at all. You should do that in (post)constructor or action method.

    0 讨论(0)
提交回复
热议问题