DispatchAction sounds like the right answer here, but remember that good
design generally dictates that the shorted a class is, the better. 
Therefore, you most likely want to have your DispatchAction do not much
more than make use of some helper class to do the actual functionality. 
Aside from keeping the DispatchActions small, it is better separation of
responsibilities too.

One other way to do this is to alter the action of your form on the client
via scripting.  For instance, attach this to your graph button:

<html:button onClick="myForm.action='graphAction.do';" />

You can attach that same onClick event handler to any form element you
want, setting the appropriate action mapping.

Not sure either is really better, but its another way.

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

On Fri, April 15, 2005 11:52 am, David Johnson said:
> question:
>
> Does this tip apply to the latest version of Struts? I'm using V1.2.4
> and I notived this tip references the "perform()" method which as far
> as I know is deprecated.
>
> I implemented this as it recommends, setting parameter="dispatch" in
> the ActionMapping, but the methods I've created (with the same
> signature as the execute() method arent being called,
>
> for example: my "report" submit button html is now
>
> <html:submit property="runReportFlag" onclick="set('report');">Run
> Report</html:submit>
>
> but the "report" method isnt being called....
>
> what did I miss? Ted?
>
>
> On 4/15/05, David Johnson <[EMAIL PROTECTED]> wrote:
>> GREAT solution!!! Thank you both very much, and of course thanks to
>> Ted H as well!
>>
>> -D
>>
>> On 4/15/05, Rafael Taboada <[EMAIL PROTECTED]> wrote:
>> > Hi. U can use DispatchAction class to have different methods for each
>> > function u have in ur form.
>> >
>> > For different buttons, there is a possibility to use
>> > LookupDispatchAction class. Don't forget to map the keys.
>> >
>> > On 4/15/05, David Johnson <[EMAIL PROTECTED]> wrote:
>> > > All
>> > >
>> > > I have a large page with a form on it that I need to submit to
>> > > diffferent actions depending on that the user clicks.
>> > >
>> > > For example, I have on this page
>> > >
>> > > 0. a list of items the user can select 1-->n of (using checkboxes)
>> > > 1. a list of graph types, with a "graph chosen now" button (user
>> > > chooses things from item #0 above)
>> > > 2. a list of reports, with a "report chosen now" button (user
>> chooses
>> > > things from item #0 above)
>> > > 3. a "combine selected" buttons (again user chooses things from item
>> #0 above)
>> > > 4. a "create new" button
>> > >
>> > > Essentially I may need to access some or ALL of the form fields seen
>> > > on the page regardless of which path the user takes, so I assume
>> that
>> > > means one big form.
>> > >
>> > > the problem is I want to submit to "graphAction" for graphs or
>> > > "reportAction" for reports or "combineAction" etc.
>> > >
>> > > how is this kind of thing normally handled? I have simple forms that
>> > > have obvious attribures but this feels different somehow.
>> > >
>> > > thoughts?
>> > > --
>> > > -Dave
>> > > [EMAIL PROTECTED]
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > >
>> > >
>> >
>> > --
>> >
>> > Rafael Taboada
>> >
>>
>> --
>> -Dave
>> [EMAIL PROTECTED]
>>
>
>
> --
> -Dave
> [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