The ActionServlet creates the ActionForm bean in the processActionForm
method, and populates it in the processPopulate method. See the source
code for details. 

Though, I don't understand why you don't let the controller do this for
you, by specifying the name of the ActionForm bean in the ActionMapping.
The ActionForm is then passed to the process method of your Action
where you can do whatever is needed. 

If an Action can handle more than one ActionForm, you can use more than
one mapping.


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/


Tony Li wrote:
> 
> Hi everyone,
> 
> I have a situation in which I would like to do the following:
> 
> 1) I'm at a jsp page, let's call it "a.jsp".  It has one link that looks
> like:
> 
>         <html:link page="/mainMenu.do?action=customer"> Customer
> </html:link>
> 
> 2) My mainMenu action in struts-config.xml looks like (name="..." is
> left out on purpose):
> 
>   <action       path="/mainMenu"
>                 type="net.alfa.china.menus.MainMenuAction">
>         <forward name="customer" path="/customer_main.jsp"/>
>         <forward name="order" path="/order_main.jsp"/>
>         <forward name="purchase" path="/purchase_main.jsp" />
>         <forward name="inventory" path="/inventory_main.jsp" />
>   </action>
> 
> 3) Inside of perform in MainMenuAction, I would like to create my own
> form bean of type ActionForm.  I am then going to load a customer from
> my db (through a business logic bean), and set the fields in the
> ActionForm.  I'm hoping to use that ActionForm to populate a form in
> "customer_main.jsp" when we finally forward there.  That form is defined
> using <html:form>.
> 
> I'm basically wondering what the mechanism is that struts uses to
> populate a <html:form> with an ActionForm.  I'm coming from a page
> without a form (a.jsp), would like to be able to create an ActionForm in
> perform(), stick it in the request, and when I forward to my
> customer_main.jsp, have struts populate the form there with what's in
> the ActionForm.
> 
> I've tried quite a few different approaches and can't seem to make it
> work.  Is this possible?  Any suggestions?
> 
> Thanks,
> 
> Tony Li

Reply via email to