*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Reset session scoped backing bean values" Watch "Reset session scoped backing bean values" New topic
Author

Reset session scoped backing bean values

Ven Red
Greenhorn

Joined: Nov 10, 2007
Posts: 6
Hi

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 ...it 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?

Thanks
Ven
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)
Venkata
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.

Thanks
Ven
philip f williams
Greenhorn

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

Phil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reset session scoped backing bean values
 
Similar Threads
Using properties file in source file
MVC Model and Domain Model
Re-Render Problem after ValidationException
Best to populate components with values when page loads
JSF Portlet and instance variables