Here is something I pulled from the archive and the
latest discussion seem to indicate that this is how it
works:

1. Controller receives request. 
2. Controller looks up mapping for Action and what
ActionForm to use. 
3. Reset is invoked on the bean. N.B.  The instance of
the ActionForm either already exists (created by a
previous Action) or is created when the HTML for the
form is generated (as the form is being given to the
user for modification). (It is possible that the
ActionForm does not exist and this is typically a
"create" action).  Reset is not called at this point
because maybe the form has been preloaded with info or
maybe the form is being returned to the user because a
previous validation failed. Reset() is invoked when
the form has been filled out and is on its way back to
the server. The form is then cleared and filled with
the new parameters before being delivered to the
Action. So form creation takes place as the HTML is
going out and the reset is invoked when the data is on
its way back. They don't happen together. 

- Sandeep
--- Tony Li <[EMAIL PROTECTED]> 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
> 


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

Reply via email to