I too agree that you should, "Remove the variable from the session context
manually". I've run into the same issue. JSF doesn't currently have a good
lifecycle framework that allows for doing things like reinitializing backing
beans that are currently in session state. Here's what I have been doing
in instances where I know that I need to reinitialize a backing bean or
other objects that are currently stored in the session scope.
I have a Helper class with a few helper methods. With helper methods, I've
centralized repetitive code.
public static final void removeSessionObject(String name) {
final FacesContext context = FacesContext.getCurrentInstance();
context.getExternalContent().getSessionMap.remove(name);
}
As an example, in my PersonAddressListBean class, before calling my person
address form, to view a specific address, I do the following:
public String addressLink() {
Helper.removeSessionObject(AppConstants.BEAN_PERSON_ADDRESS_LIST);
Helper.removeSessionObject(AppConstants.BEAN_PERSON_ADDRESS);
final AddressVO address = (AddressVO) getRowData(getForName());
Helper.putSessionObject(AppConstants.SESSION_ADDRESS_VO,address);
return LINK_ADDRESS;
}
I place a new Address value object into session scope.
I remove the PersonAddress backing bean so that a new one will be
instantiated and the constructor will be called. In the constructor of the
PersonAddress, I retrieve the Address value object.
I also removed the PersonAddressList backing bean from session scope. That
way if I modify, add or delete one or more addresses, PersonAddressList will
get re-instantiated and refresh its data from the database and show the most
recent updated list of changes.
I feel this is crud and adds unnecessary code to my backing beans. But it's
the best that I have come up with thus far and it works.
Hycel
> Remove the variable from the session context manually.
>
>
> On Tue, 23 Nov 2004 03:15:48 -0800 (PST), No Galz <[EMAIL PROTECTED]>
wrote:
> > Hii All,
> >
> > I m still on my Login issue and i have a wierd problem
> > with my app. For ex:
> >
> > I m using server side state saving, and my app has no
> > logout feature.
> >
> > Problem--> If the user logs in the first time and the
> > Security filter checks for the authentication, and
> > forwards to the required page. Next, when the user go
> > back to the login back..and logs in with incorrect
> > information...the faces context restores the values
> > from the old view!!!!! this sucks!!
> >
> > In case of login, i don't want the faces context to
> > apply this restore value phase. Is it possible???
> >
> > Regards
> > fargo
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > The all-new My Yahoo! - Get yours free!
> > http://my.yahoo.com
> >
> >
>
>
> --
> If you don't have a GMail account, I probably have 5 invites. Just ask!
> -Heath Borders-Wing
> [EMAIL PROTECTED]
>