Form values when forwarding to an action

I have an issue with my form values disappearing when I forward to an action. It is my understanding that if you set scope="session" in your struts config, Struts will store your form in the user's session using the name provided in your struts config. Further, it is my understanding that when an action is called, it will search the session for an existing form and create one if it is not found. Am I right so far?

An overview of my situation (without getting too deep into the specifics of my code or project)... I have an action -- we'll call it ProcessAppAction -- that can be approached from two different ways. The first and simplest way is directly with ProcessAppForm being all null values. The second way is by being called from another action with a prepopulated ProcessAppForm. For instance, I might have an action called ProcessExistingAppAction that pulls values from a DB, populates a ProcessAppForm, stores it in the user's session as processAppForm (the name specified in the struts config), then forwards to ProcessAppAction.

Using the assumptions listed above, ProcessAppAction should check the session for an existing form and use it or create one if it is not found. My problem is Struts is ignoring the populated form I've placed into the session and replacing it with a reset()-ed form.

I think I'll throw some loggers in to see if ProcessAppAction is overwriting my stored form with a new form instance or retrieving my existing form and calling reset().

Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258

posted Aug 26, 2005 09:56:00

0

Sorry, after reading the post again could you tell me ..

why is your processAppExistingAction after populating the form, calling another (processAppAction) action. It should be calling the jsp page. I'm guessing your form gets reset by struts when you call the next action.

if processAppExistingAction calls the jsp it should get populated. you may also have to work into designing the flow. try to keep it Action 1-> JSP 1 -> Action 2 -> Jsp 2. [ August 26, 2005: Message edited by: mannu kapoor ]