struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kam Lung Leung" <kle...@wlwa.com>
Subject RE: how to retrieve property values from previous forms/jsp pages
Date Mon, 03 Nov 2003 20:44:14 GMT
Thank David,

The second option may not work for me because the secondPage.jsp will be further
extends to hotel.secondPage.jsp, car.secondPage.jsp and so on. The purpose of the
finalPage.jsp is to echo all values that were inputted from either the hotel
group(firstpage.jsp and the hotel.secondPage.jsp), or the card group
(firstpage.jsp and the car.secondPage.jsp). Then the user have the option to
either submitted or goes back to the firstPage.jsp.  Thus I should not combine
the hotel.secondPageForm.java and car.secondPageForm.java into the
firstPageForm.java (that becomes combinedPagesForm.java). This will make the
combinedPagesForm.java too difficult to maintains in the future. The third option
looks more fit into my situation?  How do i put the action's bean in the session
scope? Do you mean setting the scope to session in the action mapping. I thought
the scope setting was for the form bean. Can you give a simple code example? 
How do I retrieve the property values of firstForms in my execute method of the
hotel.secondAction.java?

   public ActionForward execute(ActionMapping mapping,
                                  ActionForm form,
                                  HttpServletRequest request,
                                  HttpServletResponse response)
                throws Exception {

      hotel.secondForm inputForm = (hotel.secondForm) form;
      // retrieve all property values

                ....

      //Now what to do to get the firstForm from here??
   } //end execute

May be I need to use the request.setAttribute to setup a DAO object in the
firstAction.java and retrieve the DAO object from within the execute method of
the hotel.secondAction.java by using the request.getAttribute method? Can this be
done?

Thank you in advance,
Kam Lung Leung
 

On Mon, 3 Nov 2003 14:23:27 -0500, "David Friedman" wrote:

> 
> Kam,
> 
> One approach is to use hidden variables to ensure all fields are in every
> page.
> 
> Another approach is to have each action use the same form in "session" scope
> so all fields are retained between POSTs (just remember to
> getSession().removeAttribute(NAME) when you're done with it to free up
> memory.
> 
> A third approach is to put each action's bean in the "session" scope similar
> to the previous paragraph.  Again, remember to remove the session beans when
> you're finished with them to keep your memory usage down.
> 
> I prefer the 2nd approach: one bean in session scoped shared by multiple
> actions.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Kam Lung Leung [mailto:kleung@wlwa.com]
> Sent: Monday, November 03, 2003 2:18 PM
> To: struts-user@jakarta.apache.org
> Subject: how to retrieve property values from previous forms/jsp pages
> 
> 
> Hi,
> 
> I need to retrieve property values from previous pages that were inputted by
> the
> user. For example;
> I have the following pages, actions and forms.
> firstPage.jsp firstAction.java firstForm.java
> secondPage.jsp secondAction.java secondForm.java
> finalPage.jsp finalAction.java finalForm.java
> 
> In the finalAction class I need to retrieve property values that were filled
> in
> from the firstPage.jsp and the secondPage.jsp. Beside setting the scope of
> each
> form to session in the action mapping what else do I need to do so that I
> may
> retrieve those values?
> 
> Any suggestion?
> Thank you in advance.
> Kam Lung Leung
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message