aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
 
subject: DispatchAction called with different action name
 
Similar Threads
Problem regarding DispatchAction
multiple buttons in a strut form
Dispatch Action and Multiple form beans
Difference between Action And DispatchAction in struts
DispatchAction and LookupDispatchAction