You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by mfaine <mf...@knology.net> on 2005/06/17 20:55:21 UTC

Reinitializing a session managed bean

How can I reinitialize a session managed bean? The bean cannot be request
scope. I've had too much trouble with request scope managed beans in this
application.  But if I make it a session scoped bean I'll need to be able to
reload it.

Thanks,
-Mark

Re: Reinitializing a session managed bean

Posted by Rogério Saulo <ro...@gmail.com>.
I can think in 2 ways :

Think that managed bean name is "LoginBean"

You can get the bean from the session (They have the same name defined in 
faces-config) and then 
assign a new instance of the bean to the session.

FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("LoginBean",
new LoginBean());

Ou you can simply remove the bean from the session.

FacesContext.getCurrentInstance
().getExternalContext().getSessionMap().remove("LoginBean");


Rogerio 

On 17 Jun 2005 18:55:21 -0000, mfaine <mf...@knology.net> wrote:
> 
> How can I reinitialize a session managed bean? The bean cannot be request
> scope. I've had too much trouble with request scope managed beans in this
> application. But if I make it a session scoped bean I'll need to be able 
> to
> reload it.
> 
> Thanks,
> -Mark
>