You don't associate 2 form beans to one action. Ever. You can't.

Why do you think you need to associate 2 forms to an action? What is it
about the action that makes want it to use two forms? What is it exactly
youre trying to accomplish here?

The reason your example complained about a missing getter for your checkbox
is that you had F1 feeding into A1, and A1 forwarding into A2, and F1 does
not have the checkbox property that A2 needs. Hence the exception.

Presumably you want J2 to display after A1 so the user can select the
checkbox. Would your application allow you to have A1 and A2 use the same
form (with checkbox...nothing says you have to use the property on A1).

It's difficult to help without knowing what it is youre trying to
accomplish. If A1 is something that should stick around, you can session
scope it, but I'm hesitant to recommend that without knowing if that's what
you really wanted.


> -----Original Message-----
> From: t t [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 17, 2004 11:20 AM
> To: Struts Users Mailing List
> Subject: RE: Help ! Question regarding Action and Form Bean(trouble
> remains )!
>
>
> Hi, Joe,
>
> Thank you for your quick answer. I did let A1 forward
> to J2 first. But I didn't figure out how to associate
> both F1 and F2 to A1. That's why I broke A1 to A1 and
> A2, and associate F1 to A1, F2 to A2. But It still
> didn't work. And that's why I came up the original
> question: How to associate two form beans to one
> action?
>
> Thanks.
> Tong
> --- Joe Hertz <[EMAIL PROTECTED]> wrote:
>
> > What you want is for A1 to forward to J2. Not A2.
> >
> > J2 will display and then submit F2 to A2.
> >
> > Forwarding from one action to another is almost
> > always bad (Okay, I admit
> > that I've done it in some cases where I *know* the
> > Action won't ever care
> > about the request parameters. This clearly isn't one
> > of those cases.)
> >
> > -Joe
> >
> >
> > > Hi, Joe,
> > > Thank you for your answer.Let me describe it in
> > > detail. I have two jsp files, let me name them j1
> > and
> > > j2.j1 has form f1, and j2 f2. In f2, there is a
> > > checkbox. f1 triggers an action (a1) which will
> > look
> > > at the data in f1 and end up in j2. Currently, I
> > let
> > > a1 associate f1, and forward to another action a2,
> > a2
> > > associate with f2. But the server always says no
> > > getter mathod for the checkbox. But there is a
> > getter
> > > method in form bean f2.
> > > Any help will be appreciated!
> > >
> > > tong
> > >
> > > --- Joe Hertz <[EMAIL PROTECTED]> wrote:
> > >
> > > > It would help if you described this in more
> > detail.
> > > > I hope this explains it
> > > > for you.
> > > >
> > > > If you have a JSP that submits a form using
> > > > <html:form>, you have to have
> > > > that action associated to that form, otherwise
> > you
> > > > will get an exception
> > > > when that JSP is loaded.
> > > >
> > > > If you have a JSP that wants to display data in
> > a
> > > > form bean (or any other
> > > > bean really) but doesn't need to submit it to an
> > > > action, you don't need to
> > > > do anything special. You can generate the data
> > your
> > > > action and pass it to
> > > > the JSP using request.setAttribute(String,
> > Object).
> > > > Your JSP just needs to
> > > > refer to it by the name you passed into it. I
> > often
> > > > use formBeans for this
> > > > purpose just because DynaBeans are easy to
> > define,
> > > > and with Hubert Rabago's
> > > > FormDef plugin, it's pretty trivial to get
> > DynaForm
> > > > beans instantiated and
> > > > populated with exactly what I need on the
> > display
> > > > side.
> > > >
> > > > > -----Original Message-----
> > > > > From: t t [mailto:[EMAIL PROTECTED]
> > > > > Sent: Saturday, October 16, 2004 7:36 PM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: Help ! Question regarding Action and
> > Form
> > > > Bean!
> > > > >
> > > > >
> > > > > Hi,all,
> > > > >
> > > > > My action is triggered in one jsp file, and
> > will
> > > > end
> > > > > up in another JSP file, both have a form bean
> > > > inside.
> > > > > And the action has to deal with both form
> > beans.
> > > > > Question: How can I associate both form bean
> > to
> > > > one
> > > > > action?
> > > > > Thanks in advance!
> > > > >
> > > > > Tong
> > > > >
> > > > >
> > > > >
> > > > >
> > __________________________________________________
> > > > > Do You Yahoo!?
> > > > > Tired of spam?  Yahoo! Mail has the best spam
> > > > protection around
> > > > > http://mail.yahoo.com
> > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > 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]
> > > >
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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]
> >
> >
>
>
>
>
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
>
> ---------------------------------------------------------------------
> 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