This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes DispatchAction called with different action name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DispatchAction called with different action name" Watch "DispatchAction called with different action name" New topic
Author

DispatchAction called with different action name

kavin clain
Ranch Hand

Joined: Jan 19, 2010
Posts: 68
One of my action class extends DispatchAction: having methods- add, edit & remove.

register.do mapped to the action class. I must call actions this way: register.do?method=add, register.do?method=edit & register.do?method=remove.

I am using same FormBean-extends-ValidatorActionForm for these methods.

Is it possible to use different actions & invoke these methods: enroll.do?method=add, format.do?method=edit & discard.do?method=remove.

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

kavin clain wrote:Is it possible to use different actions & invoke these methods: enroll.do?method=add, format.do?method=edit & discard.do?method=remove.

You can map the whatever a URL you want to map with the given Action, just make sure that the action contains the method you're passing, like in your example, the methods must be. "add, edit, remove".

You can do like this
For first case: enroll.do?method=add,


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

One more thing, from your case, its good use of MappingDispatchAction

In that case, you don't even have to append the query string, like
For first case: enroll.do?method=add,

and the resultant URL will be: enroll.do, simple
kavin clain
Ranch Hand

Joined: Jan 19, 2010
Posts: 68
Thank you Sagar... I wish to use MappingDispatchAction.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DispatchAction called with different action name
 
Similar Threads
Difference between Action And DispatchAction in struts
Problem regarding DispatchAction
Dispatch Action and Multiple form beans
DispatchAction and LookupDispatchAction
multiple buttons in a strut form