I found the UISaveState page which showed that the approach below seems
correct:  http://wiki.apache.org/myfaces/SaveState

Still have a question though - on this page it states:

"on page 2 should restore the entered data from page1 at the beginning of
the phase cycles.  thus once you reference scopebean on page2 you will get
the values from page1, before the value of the submit are applied to the
bean (if at all)."

How do I position the t:saveState within the 2nd .jsf page so that will be
restored at the beginning of the phase cycle?

thanks


-----Original Message-----
From: Tom Butler [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 06, 2006 10:45 PM
To: 'MyFaces Discussion'; [EMAIL PROTECTED]
Subject: RE: savestate question

So you are saying that t:saveState saves state only for subsequent page
views for the same page such as when using t:datascroller to scroll through
a result set, but can not be used to save state between multiple pages?

The approach I have gotten to work is to save the values for a backing bean
between pages involves using t:saveState for the SAME backingbean across the
pages - it works, but it would be helpful if someone with more experience
could review to see if there are any issues doing this:

PAGE #1
* Uses backingbeanPage1 (request scope)
* Uses t:saveState to save state of backingbeanPage1
* Contains datatable with datascroller to scroll across rows in datamodel
* Links to page #2 to view details for item from datatable

PAGE #2
*  Also uses t:saveState to save state for SAME backingbeanPage1 from page1
(note: when first come to page #2, values for backingbeanPage1 are intact)
*  When back to page #1 using a commandbutton, backingbeanPage1 state is
restored properly

Thanks
Tom


-----Original Message-----
From: Martin Marinschek [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 06, 2006 3:24 AM
To: MyFaces Discussion
Subject: Re: savestate question

Hi Tom,

Save state means that the information is stored with the state
associated to a page. Now if you change to another page, and come back
to the first one, the state of the first page has been lost, and the
state of the saveState as well.

regards,

Martin

On 2/6/06, Tom Butler <[EMAIL PROTECTED]> wrote:
>
>
>
> Found the problem here.  On the second page, I also included  a
t:saveState
> tag for the backing bean from the previous page (page that linked to
second
> page):
>
> <t:saveState value="#{searchispbean}" />
>
>
>
> I must of missed this somewhere, but also this did not seem obvious.  It
> seemed logical that if I used <t:saveState> on the first page with the
> backing bean, that when I linked to the second page, and then came back to
> the first page, then the object would be read from wherever it was
> serialized to.  Having to place a <t:saveState> on the second page (to
save
> the state for the same backing bean from the first page) does not seem to
> make sense?  Why would I need to re-serialize the bean again on the second
> page?  Anyways, if this works I'll leave it as is - I'd just like to
> understand the 'why?'.
>
>
>
>  ________________________________
>
>
> From: Tom Butler [mailto:[EMAIL PROTECTED]
>  Sent: Sunday, February 05, 2006 10:09 PM
>  To: users@myfaces.apache.org
>  Subject: t:savestate question
>
>
>
> Within .jsp page I use t:saveState to save the backing bean.
>
> <t:saveState value="#{searchispbean}" />
>
>
>
> t:saveState works to some degree, because when I remove it, t:datascroller
> can not display the datamodel (property on backing bean) when I scroll
from
> the first page to the second page - with t:saveState enabled, this works.
>
>
>
> However, when I leave the page with the t:saveState to another page, and
> then come back, the backing bean data has not been saved.
>
>
>
> The backing bean does implement the Serializable interface (the only
> addition I have made to the class is adding the "implements Serializable"
on
> the class definition - I did not add a serialVersionUID variable or
anything
> else?):
>
> public class SearchIspBean extends SortableList implements Serializable
> {..}
>
>
>
> Any suggestions?


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to