Susan Cline wrote:
Hi,

This may be a basic question, but I've struggled with
this for a while so I'm hoping someone can help me.

I have a jsp, FlightList.jsp, that uses the saveState
tag for a managed bean, flightConfig, and for a backing
bean, flight.  Also, I'm pretty new to the terminology
as well: here when I say "managed bean" lest I am
using the term wrong is that "flightConfig" is in my
faces-config.xml file with a scope of request.
"flight" is not in my faces-config.xml although it is
serializable, and has one action method.

I think you're using the term "managed bean" exactly right - something defined in the faces-config.xml file's managed bean section.


Here's the use of the saveState in the FlightList.jsp
file:

<t:saveState value="#{flightConfig}" />
<t:saveState value="#{flight}" />


So the problem I am having is that when the
commandLink with the action flight.selectedFlight is
clicked it essentially just forwards the user to the
next page, called CreditCard.jsp.
CreditCard.jsp has this relevant code:

<t:saveState value="#{creditBean}" />
<t:saveState value="#{flight}" />

When I try to display a value from the flight
variable, representing the FlightsBean I get no
output:

I can't see anything wrong myself. When the FlightList page gets rendered, the flight object should get serialized along with the view component tree. When the postback occurs and "restore view" happens, a new instance of the flight object will be created from the serialized data. Navigation then causes the next page to be rendered but the flight object should be there for that new page to reference as it renders.

As documented, t:saveState requires that the target either implement java.io.Serializable or implement StateHolder. Which are you doing? And are you sure that the fields you care about are being serialized/deserialized?

NB: I'm fairly new to SaveState usage. Someone else may well chip in with better suggestions than mine :-)

Regards,

Simon

Reply via email to