You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Tom Butler <tb...@sprintpcs.com> on 2006/02/03 21:56:52 UTC

need help - t:savestate not saving datamodel values

I'm having trouble getting t:savestate to save the datamodel contents:

 

1. "Master View page" snippet - search page displays results in a datatable

<f:view>

// searchisp bean is backing bean in request scope; dm_searchresults is
datamodel property on bean 

<t:saveState id="savsearchispbean" value="#{searchispbean.dm_searchresults}"
/>

// search form

<h:form><h:commandButton action="#{searchispbean.search}" value="Search"
/></h:form>

// display search results in data table

<h:form>

<t:dataTable id="data" value="#{searchispbean.dm_searchresults}"
preserveDataModel="false" ..>

// when user clicks item, they link to a detail page

<t:commandLink action="#{myispbean.additem}" immediate="true" >

 

2. "Detail View" page - displays details for one of the items from the
datatable.  The issue is that when I link back to the original Master page,
the datatable is empty although I have used t:saveState?

 

// return to search page - in faces-config this takes user back to master
view page above

<h:commandButton action="search" value="Return to Search" />

 

 

Since the backing bean is in the request scope, and I am using t:savestate
to save the datamodel property of that backing bean, is there anything I
need to do on the backing bean to prevent re-initialization of the datamodel
property (I don't re-initalize it in the constructor though)?

 

This is basically a shopping cart application (master view are products,
detail view adds item to shopping cart, and I am trying to return back to
the master view of items) - are there any examples available I can look at.
Note I'm trying to keep the backing bean in the request scope to preserve
memory.

 

thanks