Hi,
 
I am getting following error by doing what you are suggested. Please help me.
 
Cannot set value for _expression_ '#{myCars.data.wrappedData}' to a new value of type java.util.ArrayList.
 
The way I did is
 

<

t:saveState value="#{myCars.data.wrappedData}"></ t:saveState>

Thanks,
Emily

 
On 12/24/05, Dennis Byrne <[EMAIL PROTECTED]> wrote:
That's what I'm saying w/ <t:saveState value="#{b.dataModel.wrappedData}" /> .  [gs]etWrappedData is the List ;)

>-----Original Message-----
>From: Mike Kienenberger [mailto:[EMAIL PROTECTED]]
>Sent: Saturday, December 24, 2005 09:21 PM
>To: 'MyFaces Discussion'
>Subject: Re: why ListDataModel is not serializable
>
>Well, a ListDataModel always has an underlying data type you can save.
>I always save the List instead of the DataModel using t:saveState.
>
>
>On 12/24/05, Dennis Byrne <[EMAIL PROTECTED]> wrote:
>> ListDataModel is not Serializable because it is an implementation of DataModel, (not Serializable).  This interface is defined by the spec, so there's no changing it.
>>
>> You can't use <t:saveState value="#{b.dataModel}" /> w/ client state saving, but you can use
>> <t:saveState value="#{b.dataModel.wrappedData}" /> .  However I remember having problems when doing this w/ the 1.0.9 release in combination with the DataModel.getRowData() .  getRowData() was not returning the correct rowData (haven't tried this w/ any later build ).
>>
>> This problem is to be expected though.  <t:saveState> takes a snap shot of the wrapped data during the render response phase of request x, and restores it during the restore view phase of request x + 1 .  Doing this not only restored the data, but it appeared as though any notion of rowData was being wiped out.  In a sense, it is like calling getRowData during the render response phase of request x - obviously there is no rowData if the dataTable has not even been rendered.
>>
>> You have options though.  You can still use t:saveState but stop using getRowData().  Instead of getRowData(), use t:updateActionListener to "tell" the backing bean the id of the row that was chosen.  Someone else around here may have something to say about another option : using @preserveDataModel for t:dataTable .
>>
>> >-----Original Message-----
>> >From: Dave [mailto:[EMAIL PROTECTED]]
>> >Sent: Saturday, December 24, 2005 05:09 PM
>> >To: [email protected]
>> >Subject: why ListDataModel is not serializable
>> >
>> >I need to use <saveState> to save a backing bean that has a data list of ListDataModel type.
>> >
>> >  class BackingBean {
>> >     ListDataModel dataList;
>> >
>> >     public DataModel getDataList() {
>> >        return dataList;
>> >     }
>> >  }
>> >
>> >  the dataList is passed to <dataTable>  for display/edit.
>> >
>> >  But ListDataModel is not serializable. It might be ok for server side saving that actually keep everything in memory. But it will not work for client side saving.
>> >
>> >  Why is ListDataModel not serializable?
>> >  The reason I use JSF ListDataModel instead of java.util.ArrayList is is that I need to know the current row from Backing Bean by
>> >  if (dataList.isRowAvailable()) {
>> >      Object currentRow = dataList.getRowData();
>> >      ....
>> >  }
>> >
>> >  Is there another way to know the current row from backing bean?  Event Listeners can access the UI component and its data model though the event. But the code is not in an event listener.
>> >
>> >  Thanks and happy holiday!
>> >  Dave
>> >
>> >
>> >
>> >---------------------------------
>> >Yahoo! for Good - Make a difference this year.
>>
>>
>>
>



Reply via email to