struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay sissom <jsis...@toybox.uits.indiana.edu>
Subject Re: ActionForm and default values
Date Sun, 24 Feb 2002 02:48:54 GMT
I've missed most of the thread on this, but if the struts-config.xml was 
as you listed, wouldn't an easier way of getting the form bean be:

   ContactForm cForm = (ContactForm)form;

where form is one of the parameters passed to the perform method?

This is the way we do it in our applications.

Thanks
Jay

On Sat, 23 Feb 2002, Sarah Farrell wrote:

> So the answer, in code, from within my ReviewAction class is the line:
> 
>         ContactForm cForm = (ContactForm)
> request.getSession(false).getAttribute("contactForm");
> 
> where "contactForm" is the name in the struts-config.xml file for the
> form-bean:
> 
>         <form-bean name="contactForm"
>                 type="edu.cccs.energizer.ContactForm" />
> 
> Can't believe it was that simple.
> 
> 
> 
> At 01:34 PM 2/23/2002 -0500, you wrote:
> >If they were all sessions scope form-beans, then they would all be
> >stored in the session context under the name given in the Struts config. 
> >
> >Often, developers will use one ActionForm object under one form-bean
> >name for something like this, and just expose part of the object on each
> >page. The Struts Validator supports this idea directly with a page
> >attribute. In your case, this would mean that you could start with the
> >ReviewActionForm, and just fill that out page by page. 
> >
> >The form-bean is an element in the Struts configuration file that the
> >ActionServlet uses to create and populate ActionForm objects. The
> >ActionFormBean represents the properties in the configuration file, akin
> >to the ActionForward and ActionMapping classes. So, the ActionFormBean
> >object tells the ActionServlet what ActionForm object to instantite. 
> >
> >(And boy do we regret calling everything Action* =:o)
> >
> >-Ted.
> >
> >
> >Sarah Farrell wrote:
> >> 
> >> Short story:
> >> 
> >> I need to retrieve existing ActionForms (ActionFormBeans?) from the 
> >Controller
> >> Servlet or from the current Session. (I also do not understand the
> difference
> >> between an ActionForm object and an ActionFormBean object).
> >> 
> >> Long story:
> >> 
> >> I have this web application with about 10 forms on it.  Each form has it's 
> >own
> >> Action and ActionForm associated with it.  When the user is done with
> filling
> >> out the last form, I'd like them to go to a "review" page that shows all the
> >> fields from all 10 forms on it in text only.  Something that they can 
> >print out
> >> easily and keep for their records.  But I can't just use a bunch of
> >> <jsp:usebean> or <bean:write> tags in the review.jsp because I've
got to do
> >> some text manipulation/conversion to nice English from database values, etc.
> >> that ends up being way too much logic in the jsp.
> >> 
> >> So I thought I'd create a ReviewAction and a ReviewActionForm.  I wanted to
> >> call the ReviewAction first, have it get all the properties from all of the
> >> other ActionForm/Beans and set all the properties/values in the
> >> ReviewActionForm. Then have the review.jsp just display the properties of
> the
> >> ReviewActionForm.
> >> 
> >> ?
> >> 
> >> At 12:34 PM 2/23/2002 -0500, you wrote:
> >> >I'm not sure if we know what you are trying to do =:o)
> >> >
> >> >Sarah Farrell wrote:
> >> >>
> >> >> All I can say is that I was really tired last night.  Because this

> >certainly
> >> >> does not work.  So I still could use some help.....
> >> >
> >> >
> >> >-- Ted Husted, Husted dot Com, Fairport NY US
> >> >-- Developing Java Web Applications with Struts
> >> >-- Tel: +1 585 737-3463
> >> >-- Web: http://husted.com/about/services
> >
> >--
> >To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> >For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 


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


Mime
View raw message