On 8/1/06, octoberdan <[EMAIL PROTECTED]> wrote:
Is there a way to access the beans persisted with t:saveState? I was going to
implement StateHolder, but I then read
http://issues.apache.org/jira/browse/TOMAHAWK-509 . Can somone please
provide further insite?

On 8/1/06, octoberdan <[EMAIL PROTECTED]> wrote:
I forgot to mention that I'd be accessing them via a servlet called by
javascript rendered in the page. How do you access it by ID? Not quite sure
what you mean...

Depends on what kind of state saving you are using.   I'm not sure how
it works with server-side state saving, but with client-side state
saving, the bean is going to be persisted by encoding it into the
hidden input jsf_state_64 (or maybe it's in jsf_tree_64) form value.

So to access it, you'd have to get the form value and run a
restore-state operation on it.

You might be better off storing the bean in a session-scoped
attribute.   Or perhaps creating a session-scoped Map of such beans
(with some kind of lifespan algorithm) and passing the key to the bean
in the map to your javascript in order to retrieve the bean.

Another possiblity:   Make your servlet into a post-processing servlet
filter.   Call JSF and let it restore the state, then have a
phase-listener move the bean into the request scope and set
responseComplete.   Then your filter can detect the existance of the
bean in the request scope and act accordingly.

Actually maybe you can simply have the JSF phase-listener redirect the
request to your specialty servlet instead of using a servlet filter.

Reply via email to