In the example below, the "FirstAction" action is responsable for getting a list from the db and pass it to the form "Form".

During the execution of the "action.First" class, doesn't exists yet any instance of the form. When the "action.First" class redirects to the "form.jsp", after loading the refered list, there exists an <htm:form action="/FirstActionSubmit"> and here the Struts creates a new instance of the form.

So, how can I pass the list loaded in the "FirstAction" to the "Form", without using request?
   The form instance is only created in the view!

   - puzzled! -

       <form-bean name="Form" type="forms.Form" />

       <action path="/FirstAction" type="action.First">
           <forward name="success" path="/form.jsp" />
       </action>

       <action path="/FirstActionSubmit" type="action.FirstSubmit"
           name="Form"
           scope="request"
           input="/form.jsp"
           validate="true"
       >

----- Original Message ----- From: "Dave Newton" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Thursday, March 23, 2006 10:13 AM
Subject: Re: Strange Form Reset Behavior


Marcio Ghiraldelli wrote:
How? Supose I have a form with an select combo. The itens should be
populated with a database result. The only way I could acomplish this
is getting data on the Action before the form view, set the list in
the request, redirect to the view. Then, the view creates an instance
of the form, the reset is called and them it populates the data via
the request.

   How should I populate the form BEFORE Struts reaches the view, as
doens't exists an form instance before it??

The view doesn't create an instance of the form, the Action does, and
passes it to the view.

For instance, I have often used a simple subclass of Action as a base
class for all my actions that separates the execute method into
executeGet and executePost methods. This methods might share some
functionality in a certain Action, like populating a list for a drop-down.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to