How to make a page remember custom properties across user sessions

I found that a page "remembers/maintains" its state - for example, all fields on the page are saved even if you click on hyper links to go to other pages and come back to your original page, it will still have the data you entered. This even works for data table and sorting.

Now, if I add a custom property (i.e String customerID), then its value is not saved. As soon as I click on a link and come back to the same page, the value goes back to default value -- even when all the other components in the page have maintained it value/state.

I could make the property in SessionBean, but then my SessionBean will look ugly with way too many properties (one for each RowSet parameter, i.e customerID, partID, userID, shipmentID, and 20 other IDs, etc..). In the examples, they have used SessionBean for this purpose. I thought that since all components of a page remember its state, then custom properties should do that too, why not?

Message was edited by:

Sabir

[994 byte] By [Sabir] at [2007-11-26 11:21:38]
# 1

> In the examples, they have used SessionBean for this purpose. I thought that

> since all components of a page remember its state, then custom properties

> should do that too, why not?

Many components can remeber it's state, even when not bound to a backing (session) bean, because there is enough information on the html code to let the FacesServlt rebuild them. Maybe with the aid of a hidden component you can keep some values without saving them in a backing bean.

I guess that in your case you may generate more session o application beans, and in this way keep your code organized and your default session bean won't grow so much.

Best regards

Antonio.

antoniovl at 2007-7-7 3:37:03 > top of Java-index,Development Tools,Java Tools...
# 2
Good idea. I will play around with components to see which ones can I use for this purpose. May be Creator should have non-visual component, just for this purpose - saving page specific parameters.
Sabir at 2007-7-7 3:37:03 > top of Java-index,Development Tools,Java Tools...
# 3
Sorry, duplication of info on a similar thread: Use a hidden field -- exact same lifecycle and handling as every thing else you're trying to match...
yossarian at 2007-7-7 3:37:03 > top of Java-index,Development Tools,Java Tools...