Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reset JSF Backing Bean(View or Session Scope)

Tags:

jsf

I want to reset by JSF backing bean when some method is invoked. Assume that there is a command button, someone press it and after succesfull transaction, my View or Session scope JSF bean should be reseted. Is there a way to do that?

Thank

like image 441
Ahmet DAL Avatar asked Feb 27 '12 01:02

Ahmet DAL


1 Answers

I solve the problem with code like this:

((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getSession().removeAttribute("bean name");            

By this way I enter to session scoped bean and reset it without the data that was there before

like image 199
Luis Manrique Avatar answered Oct 20 '22 13:10

Luis Manrique