File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Reset session scoped backing bean values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Reset session scoped backing bean values" Watch "Reset session scoped backing bean values" New topic

Reset session scoped backing bean values

Ven Red

Joined: Nov 10, 2007
Posts: 6

how can i set the backing bean values(properties) to null in java scipt.

My case is:

ented to and from dates in a screen , which maps the entered values to backing bean. if it successfully gets the records from the databse i can continue to the next screen and if not come back same screen with values. This part is done. but if i goto any part of the other website by clicking the links provided in the page should nullify the entered values and leave the page.(just setting the form field values to null doen't work here, since the fiedls are mapped to backing bean properties, so we need to change them). Can we do this java script? or any other way?

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
here is one way of doing this:

lets call your screen that has the "to" and "from" dates as "blah.faces"

set up a filter / viewhandler that does this :-

1. get the requested url
2. if the requested url is not "blah.faces" and then remove the backing bean from the session attributes.

[ November 12, 2007: Message edited by: Richard Green ]

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Ranch Hand

Joined: Sep 07, 2007
Posts: 37
Hi Richard,

Thanks for your reply. I would be able to solve the issue with your idea.

philip f williams

Joined: Mar 02, 2008
Posts: 3
Do you have an example of the code to do this?

I agree. Here's the link:
subject: Reset session scoped backing bean values
It's not a secret anymore!