In the home page we have, where more than one form is required, we have used frames.  
The frames src points to action which prepopulates the form and is displayed in the 
jsp. Which also means there is a separate jsp page for each form.

Jayaraman  

-----Original Message-----
From: Rick Reumann [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 2:56 PM
To: Struts Users Mailing List
Subject: Re: one more prepopulate question


On Fri, 28 Feb 2003 12:50:56 -0500
"Sri Sankaran" <[EMAIL PROTECTED]> wrote:
 
> Where are you running into a problem?

I think the initial problem was how you would pre-populate several
ActionForms inside of one Action and then be able to use those
ActionForms to create several forms in the resulting JSP page.

>From what I can gather this is not too difficult as all you would do is
create as many ActionForm instances as you need in your SetupAction and
then put them all into request scope. You then can set up multiple forms
as you see fit on the fowarded to JSP page. 

The only thing I haven't found a nice work around for is that you can
only use one mapping.getAttribute() call in the Action for the form
associated with that Action. In example will help.

You have an Action class that you want to use to prepopulate three
Action Forms and then forward to a JSP page and set up three separate
forms. So you might have a mapping...

<action path="/setupMultipleForms"
        type="foo.bar.SetUpFormsAction"
        name="form1"
        scope="request"
        validate="false"
        >
        <forward
                name="continue"
                path="/severalFormsOnAPage.jsp"/>
</action>

So now in the SetUpFormsAction you can easily put Form1 into scope by:
 
Form1 form1 = (Form1)form;
form1.setFoo("hello");
request.setAttribute(mapping.getAttribute(), form1 );

But now for another ActionForm (Form2) to put into scope you'd have
Form2 form2 = new Form2();
form2.setFooBar("BLA");
request.setAttribute( "form2", form2 );

The part I don't like is you now have to remember that you need to
remember that you HAVE to refer to your Form2 object as "form2" in your
mapping set up in your struts-config.xml file or else you JSP page will
not be able to find it. It's not a super big deal, but a bit annoying. 
Maybe there is another way to do it that I'm missing.


-- 
Rick Reumann

---------------------------------------------------------------------
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