I don't think Daniel's idea will work.

If the action form does not exist then
struts wants to instantiate the form.

Therefore struts needs to know the type.

It might work if you have a session scope form already there.

I think of actions as the most dependent class,
i.e. nothing should depend on actions (no other classes should know anything
about actions),
actions should depend on everything (well not everything, but definitely the
model and the view).

Because they are such nasty beasts, (and because in struts they should have
no state),
they should be very small.

Since they are so small the architecture that puts effort into 
making them generic and reusable may be misguided.

Brendan


-----Original Message-----
From: Suzette Daniel [mailto:[EMAIL PROTECTED]
Sent: Monday, July 21, 2003 9:41 AM
To: 'Struts Users Mailing List'
Subject: RE: html:form tag and coupling between ActionForm and Action


I just wanted to add a little bit more to Alex's comment. 

1.Create a form interface that represents your family of forms
        abstract class PersonForm extends ActionForm{
                getFirstName();
                getLastName();
                getMiddleName();
        }
2.Make your forms implement that interface
3.In your action cast ActionForm to your interface 
        PersonProcessingAction extends Action {
        ....
                Person personForm = (PersonForm)form;
                String first = personForm.getFirstName();
        ....
        }


-----Original Message-----
From: Alex Shneyderman [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 21, 2003 12:31 PM
To: 'Struts Users Mailing List'
Subject: RE: html:form tag and coupling between ActionForm and Action




> What if you want to write an Action that can service a
> family of several different ActionForms??

You can do it. Just need to do it yourself (well sort of).

Alex.


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

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

Reply via email to