Reputation: 363
I would like to get my JSF Component Dropdown boxes initialized for each page refresh. I already knows that JSF maintains the previous state, but is there any way that i can re-initialize the <h:selectOneMenu>
Component on each page refresh. My Backing bean is SessionScoped and I cannot change it, since i am using <f:ajax>
tag to fire a backing bean method on each onChange event of this dropdown boxes. Please help me to the solve this issue.
Upvotes: 0
Views: 1195
Reputation: 1108642
since i am using
<f:ajax>
tag to fire a backing bean method on each onChange event of this dropdown boxes
For among others exactly this reason, the view scope is been invented. Put the bean in the view scope instead.
@ManagedBean
@ViewScoped
public class Bean {
// ...
}
Each browser window/tab will get its own view scoped bean and every page refresh will recreate it. It'll also immediately fix the potential major trouble caused by unintuitive page behaviour when the user has the same page open in different browser windows/tabs in the same session while you're using a session scoped bean.
Upvotes: 0