You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andrew Tomaka <at...@gmail.com> on 2005/07/07 16:26:20 UTC

Two Forms, Two Form Beans, One JSP

Hey all,

I'm attempting to create a JSP that is made up of two forms.  Each
form needs a different form bean and is processed by a different
action.  The catch is that the first form returns back to the JSP and
the action responsible for this needs the name attribute set to the
Form Bean of the first form.  When the JSP is loaded after the
processing of the first form, both the form tags are assigned the name
of the first Form Bean.

Is it possible to assign Form Beans to a form instead of assigning
them to an action?

Thanks,
~ Andrew Tomaka

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


Re: Two Forms, Two Form Beans, One JSP

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Does the ActionForm for the bottom form only come into play when a
selection is made in the upper form?

If so, you could always instantiate the ActionForm yourself, populate it
as appropriate in the Action that fires when that selection is made, shove
it in request and deal with it manually.

One exceedingly hacky way to do this, and I'm not sure it would work but
it would be a neat experiment, is something like this:

In the Action:
--------------
MyLowerActionForm m = new MyLowerActionForm();
// Populate ActionForm as appropriate
request.setAttribute("m", m);

(of course you wouldn't use "m" as the key, but you get the idea!)

Then in your JSP, have the upper form that is exactly like it probably is
now, then, right before the lower form, add this line:

<% request.setAttribute("XXXX", request.getAttribute("m")); %>

XXXX is the key that the ActionForm would be found under if the lower form
was the only one involved.  Then code your form as usual.

What I'm thinking is that you'd want to use the same usual tags for both
forms, and allow Struts to do its thing as far as populating and such
goes... this obviously won't work if the upper form requires a different
ActionForm than the bottom, but if you overwrite the ActionForm that would
be in request at that point for the upper form with the one you manually
added to request for the bottom form, that might work.

*IF* that does work, I'm not at all sure it's a good idea, but it's an
intersting thought.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, July 7, 2005 12:46 pm, Andrew Tomaka said:
> I did consider using a single form bean for both forms, but it didn't
> really sit well with me from a design stand point.  We have two
> different forms doing two different things so there should be two
> different beans.  Heck, if I had it my way, the two forms would be on
> separate pages (wizard style), but the customer says otherwise.
>
> I do have an issue with using a single form.  The top list is a list
> of program ids.  When a program id is selected, it brings up all the
> different sheets for that program id.  The user can then select a
> sheet to edit, via radio button, and submit that request.  With this
> request, I need to pass the program id that was selected (via hidden
> field).  I can't rely on the program id in the drop down box because
> if a user performs a search, changes the drop down box and then
> selects a sheet to edit, we have a mismatch between the intended
> program id to edit and the actual program id to edit (if that makes
> any sense).
>
> ~ Andrew Tomaka
>
> On 7/7/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
>> From: "Andrew Tomaka" <at...@gmail.com>
>>
>> > My problem is that I have a "PreAction" to do the processing on the
>> > form.  This requires the page to have the form bean assigned to it.
>> > Since I have two different forms doing two different things, I should
>> > have two different form beans, but I don't see how I can accomplish
>> > that.
>>
>> There's nothing wrong with sharing one form across multiple Actions.  I
>> do
>> it for an accounting reporting webapp.  All of the forms ask for similar
>> things, such as account numbers and dates, and this makes it simple for
>> all
>> the HTML forms to "remember" their selections.  (The form is in session
>> scope, so it happens naturally.)
>>
>> Just wanted to point out that there is no ironclad one-to-one
>> relationship
>> between HTML forms and form beans.
>>
>> --
>> Wendy Smoak
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: Two Forms, Two Form Beans, One JSP

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
You could use frames for the bottom portion.  Then you really *could*
treat them as two separate pages because, well, they are!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, July 7, 2005 1:32 pm, Andrew Tomaka said:
> Using a nested form bean may actually be a viable solution that I'll
> have to look in to. Ideally though, I'd be able to treat the two
> different forms as two separate pages that just happen to share the
> same screen space.  I guess that's the downside to using a framework:
> you can't always get what you want.
>
> Anyway, I have a drawing of the flow that I'll upload when I am at
> home. Unfortunately, the proxy here doesn't allow me to write to any
> FTP space.
>
> ~ Andrew Tomaka
>
> On 7/7/05, Adam Hardy <ah...@cyberspaceroad.com> wrote:
>> Andrew,
>> if the data being edited in the two forms are related, then for the
>> child data you could use a nested bean as an attribute on the form.
>>
>> The parent data would remain as usual directly in the form.
>>
>>
>> Adam
>>
>> Andrew Tomaka on 07/07/05 17:46, wrote:
>> > I did consider using a single form bean for both forms, but it didn't
>> > really sit well with me from a design stand point.  We have two
>> > different forms doing two different things so there should be two
>> > different beans.  Heck, if I had it my way, the two forms would be on
>> > separate pages (wizard style), but the customer says otherwise.
>> >
>> > I do have an issue with using a single form.  The top list is a list
>> > of program ids.  When a program id is selected, it brings up all the
>> > different sheets for that program id.  The user can then select a
>> > sheet to edit, via radio button, and submit that request.  With this
>> > request, I need to pass the program id that was selected (via hidden
>> > field).  I can't rely on the program id in the drop down box because
>> > if a user performs a search, changes the drop down box and then
>> > selects a sheet to edit, we have a mismatch between the intended
>> > program id to edit and the actual program id to edit (if that makes
>> > any sense).
>> >
>> > ~ Andrew Tomaka
>> >
>> > On 7/7/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
>> >
>> >>From: "Andrew Tomaka" <at...@gmail.com>
>> >>
>> >>>My problem is that I have a "PreAction" to do the processing on the
>> >>>form.  This requires the page to have the form bean assigned to it.
>> >>>Since I have two different forms doing two different things, I should
>> >>>have two different form beans, but I don't see how I can accomplish
>> >>>that.
>> >>
>> >>There's nothing wrong with sharing one form across multiple Actions.
>> I do
>> >>it for an accounting reporting webapp.  All of the forms ask for
>> similar
>> >>things, such as account numbers and dates, and this makes it simple
>> for all
>> >>the HTML forms to "remember" their selections.  (The form is in
>> session
>> >>scope, so it happens naturally.)
>> >>
>> >>Just wanted to point out that there is no ironclad one-to-one
>> relationship
>> >>between HTML forms and form beans.
>> >>
>> >>--
>> >>Wendy Smoak
>> >>
>> >>
>> >>---------------------------------------------------------------------
>> >>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >>For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: Two Forms, Two Form Beans, One JSP

Posted by Andrew Tomaka <at...@gmail.com>.
Using a nested form bean may actually be a viable solution that I'll
have to look in to. Ideally though, I'd be able to treat the two
different forms as two separate pages that just happen to share the
same screen space.  I guess that's the downside to using a framework:
you can't always get what you want.

Anyway, I have a drawing of the flow that I'll upload when I am at
home. Unfortunately, the proxy here doesn't allow me to write to any
FTP space.

~ Andrew Tomaka

On 7/7/05, Adam Hardy <ah...@cyberspaceroad.com> wrote:
> Andrew,
> if the data being edited in the two forms are related, then for the
> child data you could use a nested bean as an attribute on the form.
> 
> The parent data would remain as usual directly in the form.
> 
> 
> Adam
> 
> Andrew Tomaka on 07/07/05 17:46, wrote:
> > I did consider using a single form bean for both forms, but it didn't
> > really sit well with me from a design stand point.  We have two
> > different forms doing two different things so there should be two
> > different beans.  Heck, if I had it my way, the two forms would be on
> > separate pages (wizard style), but the customer says otherwise.
> >
> > I do have an issue with using a single form.  The top list is a list
> > of program ids.  When a program id is selected, it brings up all the
> > different sheets for that program id.  The user can then select a
> > sheet to edit, via radio button, and submit that request.  With this
> > request, I need to pass the program id that was selected (via hidden
> > field).  I can't rely on the program id in the drop down box because
> > if a user performs a search, changes the drop down box and then
> > selects a sheet to edit, we have a mismatch between the intended
> > program id to edit and the actual program id to edit (if that makes
> > any sense).
> >
> > ~ Andrew Tomaka
> >
> > On 7/7/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
> >
> >>From: "Andrew Tomaka" <at...@gmail.com>
> >>
> >>>My problem is that I have a "PreAction" to do the processing on the
> >>>form.  This requires the page to have the form bean assigned to it.
> >>>Since I have two different forms doing two different things, I should
> >>>have two different form beans, but I don't see how I can accomplish
> >>>that.
> >>
> >>There's nothing wrong with sharing one form across multiple Actions.  I do
> >>it for an accounting reporting webapp.  All of the forms ask for similar
> >>things, such as account numbers and dates, and this makes it simple for all
> >>the HTML forms to "remember" their selections.  (The form is in session
> >>scope, so it happens naturally.)
> >>
> >>Just wanted to point out that there is no ironclad one-to-one relationship
> >>between HTML forms and form beans.
> >>
> >>--
> >>Wendy Smoak
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: Two Forms, Two Form Beans, One JSP

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Andrew,
if the data being edited in the two forms are related, then for the 
child data you could use a nested bean as an attribute on the form.

The parent data would remain as usual directly in the form.


Adam

Andrew Tomaka on 07/07/05 17:46, wrote:
> I did consider using a single form bean for both forms, but it didn't
> really sit well with me from a design stand point.  We have two
> different forms doing two different things so there should be two
> different beans.  Heck, if I had it my way, the two forms would be on
> separate pages (wizard style), but the customer says otherwise.
> 
> I do have an issue with using a single form.  The top list is a list
> of program ids.  When a program id is selected, it brings up all the
> different sheets for that program id.  The user can then select a
> sheet to edit, via radio button, and submit that request.  With this
> request, I need to pass the program id that was selected (via hidden
> field).  I can't rely on the program id in the drop down box because
> if a user performs a search, changes the drop down box and then
> selects a sheet to edit, we have a mismatch between the intended
> program id to edit and the actual program id to edit (if that makes
> any sense).
> 
> ~ Andrew Tomaka
> 
> On 7/7/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
> 
>>From: "Andrew Tomaka" <at...@gmail.com>
>>
>>>My problem is that I have a "PreAction" to do the processing on the
>>>form.  This requires the page to have the form bean assigned to it.
>>>Since I have two different forms doing two different things, I should
>>>have two different form beans, but I don't see how I can accomplish
>>>that.
>>
>>There's nothing wrong with sharing one form across multiple Actions.  I do
>>it for an accounting reporting webapp.  All of the forms ask for similar
>>things, such as account numbers and dates, and this makes it simple for all
>>the HTML forms to "remember" their selections.  (The form is in session
>>scope, so it happens naturally.)
>>
>>Just wanted to point out that there is no ironclad one-to-one relationship
>>between HTML forms and form beans.
>>
>>--
>>Wendy Smoak
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


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


Re: Two Forms, Two Form Beans, One JSP

Posted by Andrew Tomaka <at...@gmail.com>.
I did consider using a single form bean for both forms, but it didn't
really sit well with me from a design stand point.  We have two
different forms doing two different things so there should be two
different beans.  Heck, if I had it my way, the two forms would be on
separate pages (wizard style), but the customer says otherwise.

I do have an issue with using a single form.  The top list is a list
of program ids.  When a program id is selected, it brings up all the
different sheets for that program id.  The user can then select a
sheet to edit, via radio button, and submit that request.  With this
request, I need to pass the program id that was selected (via hidden
field).  I can't rely on the program id in the drop down box because
if a user performs a search, changes the drop down box and then
selects a sheet to edit, we have a mismatch between the intended
program id to edit and the actual program id to edit (if that makes
any sense).

~ Andrew Tomaka

On 7/7/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
> From: "Andrew Tomaka" <at...@gmail.com>
> 
> > My problem is that I have a "PreAction" to do the processing on the
> > form.  This requires the page to have the form bean assigned to it.
> > Since I have two different forms doing two different things, I should
> > have two different form beans, but I don't see how I can accomplish
> > that.
> 
> There's nothing wrong with sharing one form across multiple Actions.  I do
> it for an accounting reporting webapp.  All of the forms ask for similar
> things, such as account numbers and dates, and this makes it simple for all
> the HTML forms to "remember" their selections.  (The form is in session
> scope, so it happens naturally.)
> 
> Just wanted to point out that there is no ironclad one-to-one relationship
> between HTML forms and form beans.
> 
> --
> Wendy Smoak
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: Two Forms, Two Form Beans, One JSP

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Andrew Tomaka" <at...@gmail.com>

> My problem is that I have a "PreAction" to do the processing on the
> form.  This requires the page to have the form bean assigned to it.
> Since I have two different forms doing two different things, I should
> have two different form beans, but I don't see how I can accomplish
> that.

There's nothing wrong with sharing one form across multiple Actions.  I do
it for an accounting reporting webapp.  All of the forms ask for similar
things, such as account numbers and dates, and this makes it simple for all
the HTML forms to "remember" their selections.  (The form is in session
scope, so it happens naturally.)

Just wanted to point out that there is no ironclad one-to-one relationship
between HTML forms and form beans.

-- 
Wendy Smoak


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


Re: Two Forms, Two Form Beans, One JSP

Posted by Andrew Tomaka <at...@gmail.com>.
This is what I've ended up doing for now.  I have my one form bean for
both forms since the data is related.

What if the data isn't related though?  Does Struts provide a simple
solution or is just an area to hack around? I can accept the latter
since it's expected when using a framework.

Either way, thanks for all the help guys.  I've gotten my forms in
working condition with a design that I can put up with!

~ Andrew Tomaka

On 7/7/05, Rick Reumann <st...@reumann.net> wrote:
> Andrew Tomaka wrote the following on 7/7/2005 12:00 PM:
> > I imagine I've over complicated the problem,
> 
> Yes, I think you are:)
> 
> > My problem is that I have a "PreAction" to do the processing on the
> > form.  This requires the page to have the form bean assigned to it.
> > Since I have two different forms doing two different things, I should
> > have two different form beans, but I don't see how I can accomplish
> > that.
> 
> Here is a case where I don't believe you need to have these different
> ActionForms.  If you just need an "id" from one drop down list, simply
> sumbit to the Action and pull that id out of the request. Nothing
> forcing you to have to have ActionForm's hold everything. If you want an
> ActionForm, make just one and provide...
> 
> Integer searchID;
> Integer programID;
> 
> I don't feel this breaks desing principals since the intended use of the
> ActionForm is to collect user input data from a "page" - in this case
> you do have user data (in two lists) on one page.
> 
> --
> Rick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: Two Forms, Two Form Beans, One JSP

Posted by Rick Reumann <st...@reumann.net>.
Andrew Tomaka wrote the following on 7/7/2005 12:00 PM:
> I imagine I've over complicated the problem, 

Yes, I think you are:)

> My problem is that I have a "PreAction" to do the processing on the
> form.  This requires the page to have the form bean assigned to it. 
> Since I have two different forms doing two different things, I should
> have two different form beans, but I don't see how I can accomplish
> that.

Here is a case where I don't believe you need to have these different 
ActionForms.  If you just need an "id" from one drop down list, simply 
sumbit to the Action and pull that id out of the request. Nothing 
forcing you to have to have ActionForm's hold everything. If you want an 
ActionForm, make just one and provide...

Integer searchID;
Integer programID;

I don't feel this breaks desing principals since the intended use of the 
ActionForm is to collect user input data from a "page" - in this case 
you do have user data (in two lists) on one page.

-- 
Rick

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


Re: Two Forms, Two Form Beans, One JSP

Posted by Andrew Tomaka <at...@gmail.com>.
I imagine I've over complicated the problem, so I've taken a step back
and am looking at it from the beginning again.  The following are my
basic requirements:

When the user makes the first request, they are taken to a page with a
drop down menu.  This drop down menu is built from information stored
in a database so I need to do some pre-processing.

After that, the user chooses an option from the drop down menu and
chooses to search.  This returns a page that has the same form that
was built in the first request on top and then a second form that
lists the results of their drop down.  This allows users to choose
which of the results to edit.

At this point the user can either use the drop down menu and have the
bottom list rebuilt or choose a result to edit and proceed.

My problem is that I have a "PreAction" to do the processing on the
form.  This requires the page to have the form bean assigned to it. 
Since I have two different forms doing two different things, I should
have two different form beans, but I don't see how I can accomplish
that.

This is going to be a common thing to do throughout my entire
application so I am hoping a simple design solution will pop up.

Let me know if you need any other clarifications.

I appreciate the help so far!
~ Andrew Tomaka

On 7/7/05, Rick Reumann <st...@reumann.net> wrote:
> Andrew Tomaka wrote the following on 7/7/2005 10:26 AM:
> 
> > I'm attempting to create a JSP that is made up of two forms.  Each
> > form needs a different form bean and is processed by a different
> > action.  The catch is that the first form returns back to the JSP and
> > the action responsible for this needs the name attribute set to the
> > Form Bean of the first form.  When the JSP is loaded after the
> > processing of the first form, both the form tags are assigned the name
> > of the first Form Bean.
> 
> I'm confused what you are trying to do. Possibly you can describe the
> user requirements?
> 
> 
> --
> Rick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: Two Forms, Two Form Beans, One JSP

Posted by Rick Reumann <st...@reumann.net>.
Andrew Tomaka wrote the following on 7/7/2005 10:26 AM:

> I'm attempting to create a JSP that is made up of two forms.  Each
> form needs a different form bean and is processed by a different
> action.  The catch is that the first form returns back to the JSP and
> the action responsible for this needs the name attribute set to the
> Form Bean of the first form.  When the JSP is loaded after the
> processing of the first form, both the form tags are assigned the name
> of the first Form Bean.

I'm confused what you are trying to do. Possibly you can describe the 
user requirements?


-- 
Rick

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


Re: Two Forms, Two Form Beans, One JSP

Posted by Michael Jouravlev <jm...@gmail.com>.
On 7/7/05, Andrew Tomaka <at...@gmail.com> wrote:
> Hey all,
> 
> I'm attempting to create a JSP that is made up of two forms.  Each
> form needs a different form bean and is processed by a different
> action.  The catch is that the first form returns back to the JSP and
> the action responsible for this needs the name attribute set to the
> Form Bean of the first form.  When the JSP is loaded after the
> processing of the first form, both the form tags are assigned the name
> of the first Form Bean.
> 
> Is it possible to assign Form Beans to a form instead of assigning
> them to an action?
> 
> Thanks,
> ~ Andrew Tomaka

If you do not have prejudice against form bean with session scope, you
can use Struts Dialogs and create two JSP Controls. Each JSP Control
contains an action class and a form bean. For action class you either
can directly use DialogAction, or you may have to subclass it.

Include both controls (that is, their actions) into your JSP using
<jsp:include>. The submit request is sent directly to each control.
You need to set up action mapping for each control to set the
target/reload location. For the first control this would be you JSP
page, in which you embed the controls.

Struts Dialogs home page: http://struts.sourceforge.net/strutsdialogs
JSP control how-to:
http://struts.sourceforge.net/strutsdialogs/dialogaction-logincontrolsample.html
Live demo of JSP control:
http://www.superinterface.com/strutsdialog/embeddedmasterpage-tomcat.do

In the live demo the "Sign In" box is a JSP control.

The catch: if you use Tomcat, you cannot forward from action to JSP to
render a control, Tomcat closes response writer right after forward.
So you would need to design forward to JSP in regular way, then run
your app, Jasper will generate Java source code for your JSP, then you
need to copy that source code to your project. See the samples, they
contain all needed code. This issue will be addressed in next SRV
spec. It is a little hassle, but result worth it ;)

Michael.

--

Dialogs for Struts
http://struts.sourceforge.net/strutsdialogs

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


Re: Two Forms, Two Form Beans, One JSP

Posted by Michael Taylor <mt...@txesystems.com>.
I read this post several times.  If I understood it, the key is this line:

"...the action responsible for this needs the name attribute set to the
Form Bean of the first form..."

If I read this to mean you want a post to form A to update form B so that it has access to the state of submission to form A, then I would suggest that you use session scope and have the action for form A retrieve form B from the session and update it as needed.  You can give it a reference to the other form if you like, or you can copy the data you nead from one form to the other.

Is that what you are looking for?

Cheers,

Mike



------------------------------------------------------------------------
Michael Taylor
TXE Systems, Inc.
mtaylor@txesystems.com


Andrew Tomaka wrote:

>Hey all,
>
>I'm attempting to create a JSP that is made up of two forms.  Each
>form needs a different form bean and is processed by a different
>action.  The catch is that the first form returns back to the JSP and
>the action responsible for this needs the name attribute set to the
>Form Bean of the first form.  When the JSP is loaded after the
>processing of the first form, both the form tags are assigned the name
>of the first Form Bean.
>
>Is it possible to assign Form Beans to a form instead of assigning
>them to an action?
>
>Thanks,
>~ Andrew Tomaka
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>  
>