Hi Mani,

        If different forms are posting information to the same Action class
there are a couple of steps you need to do...

1. In your struts-config.xml file where you are declaring your action class,
don't associate a form to this Action class.

2. I assume that since multiple forms are submitting to the same action
class, each form is associated with its own jsp page. i.e A bunch of jsp
pages, each having its own ActionForm submit to the same Action class. In
that case in the <html:form> tag in your jsp page, write the form name. So
every jsp page will have its own unique form object, all submitting to the
same action. These forms are declared in the struts-config.xml file. You
should take care not to associate these form classes to your single action
class as mentioned in the previous step.

3. In your Action class, you might want to set the form bean to either
request, session or page scope depending on your requirements. 

4. Something you might want to consider is using inheritance on your
ActionForms (if they contain almost same values).

Hope this helps....

cheers,
Amar..


-----Original Message-----
From: B Manikandan [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 11, 2001 10:06 AM
To: [EMAIL PROTECTED]
Subject: Re: Passing request to a common action class from multiple
forms


   I have a domain.jsp which has a button on click of which action is
forwarded
to an action class which displays cascade.jsp.
    In cascade.jsp the objects displayed are same even though their values
may
be different.User can select some values and these values have to be passed
back
to input.jsp.
    The reason for the common action class is because,the functionality is
same
for all forms which have to call cascade.jsp.The variables to be selected
from
cascade.jsp (oid and name) is always same,even though their values may be
different.

How to get input from different forms and pass it back to the callee form.

If it sounds "spaghetti" is there a better way of implementing it.

Mani



"Nanduri, Amarnath" wrote:

> Can yo be more detailed ? All i gather sofar from your requirements is
that
> your company is planning to implement some spaghetti code (no offense
meant)
> using struts while everybody is trying to run away from it.
>
> cheers,
> Amar..
>
> -----Original Message-----
> From: B Manikandan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 11, 2001 9:25 AM
> To: struts
> Subject: Passing request to a common action class from multiple forms
>
> Hi,
>    I have a common Action class,which will receive request from multiple
> forms.
>
> This action class will then forward request to a common jsp and on
> selection of a value from this jsp,the value has to be set in the input
> form(which called the common action class).
>
> Then,request has to be forwarded to the input form.
>
> How to do this ?
>
> Mani

Reply via email to