You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by otisg <ot...@ureach.com> on 2002/12/27 20:39:53 UTC

DispatchAction and 'input' param in struts-config

Hello,

When using DispatchAction to group multiple
activities in a single action class, how
does one deal with struts-config.xml?  I
didn't see this addressed in any Struts
articles nor in the Javadoc.

In particular, how does one use action's
"name", "input" and "validate" attributes of
the "action" element?

One can specify only 1 "name", and only 1
"input", but if one if grouping multiple
activities in a single action class, there
are usually multiple names (forms) and
inputs (pages with forms).

Example:
Consider AccountManager class (a subclass of
DispatchAction) with 2 methods: create and edit.
The 'Create Screen' might contain a form
with only 2 fields:
    first name, and last name.
The 'Edit Screen' may contain a form with
more fields:
    email, address, etc.

So how does one specify "name" and "input"
here, when there are really 2 different
names and inputs here?

Does one have to code the templates/pages
with the logic that renders the appropriate
form based on the activity (create or edit)?


Similarly, what happens with 'validate'
attribute of an action?
How does one determine which activity is
occurring when validate method is called, so
that the correct fields can be validated?
In the above example, how does one know
whether Create or Edit activity is happening?

Thanks,
Otis


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DispatchAction and 'input' param in struts-config

Posted by Max Kremer <mk...@datastay.com>.
Hi,

   What you should use the DispatchAction for is grouping related
operations. For instance creating a new item and updating an existing item.
These both use the same input forms. If you have two operation that are
unrelated and depend on two different ActionForms then you should make them
independent actions.

In your case you can merge all the properties from both operation into one
single ActionForm and then use the ones you need in each method of the
DispatchAction. As for the input attribute in the config, you can make that
anything you want. Just create multiple JSPs to submit to your
DispatchAction.

----- Original Message -----
From: "otisg" <ot...@ureach.com>
To: <st...@jakarta.apache.org>
Sent: Friday, December 27, 2002 2:39 PM
Subject: DispatchAction and 'input' param in struts-config


> Hello,
>
> When using DispatchAction to group multiple
> activities in a single action class, how
> does one deal with struts-config.xml?  I
> didn't see this addressed in any Struts
> articles nor in the Javadoc.
>
> In particular, how does one use action's
> "name", "input" and "validate" attributes of
> the "action" element?
>
> One can specify only 1 "name", and only 1
> "input", but if one if grouping multiple
> activities in a single action class, there
> are usually multiple names (forms) and
> inputs (pages with forms).
>
> Example:
> Consider AccountManager class (a subclass of
> DispatchAction) with 2 methods: create and edit.
> The 'Create Screen' might contain a form
> with only 2 fields:
>     first name, and last name.
> The 'Edit Screen' may contain a form with
> more fields:
>     email, address, etc.
>
> So how does one specify "name" and "input"
> here, when there are really 2 different
> names and inputs here?
>
> Does one have to code the templates/pages
> with the logic that renders the appropriate
> form based on the activity (create or edit)?
>
>
> Similarly, what happens with 'validate'
> attribute of an action?
> How does one determine which activity is
> occurring when validate method is called, so
> that the correct fields can be validated?
> In the above example, how does one know
> whether Create or Edit activity is happening?
>
> Thanks,
> Otis
>
>
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
> -
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>