aspose file tools*
The moose likes Struts and the fly likes Dispatch Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dispatch Action " Watch "Dispatch Action " New topic
Author

Dispatch Action

Pawar Santoshkumar
Greenhorn

Joined: Jul 03, 2006
Posts: 10
can we write execute method in the action class extended from DispatchAction
OR LookUpDispatchAction.
if(yes)
{
why?
}
else
why?


please reply?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Yes, you can write an execute method for a DispatchAction, but would you really want to?

Think about it: The logic to dispatch to another method is in the execute method of the DispatchAction superclass. If you override that method, you could disable the dispatching ability.

One possible reason you might want to override it would be if there is some common logic you want to perform before dispatching to the various methods. In that case you could perform your logic and then call super.execute() to dispatch to the other methods.
[ July 28, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Rick Charles
Greenhorn

Joined: Jul 27, 2006
Posts: 25
Hi,

Say i am having a common operation of populating a record from database,(for eg)for update and view operation i need to populate values from the database. in that case i require to perform a common operation in one method and transfer control automatically to another method. I need to perform this operation only once just like init() method of servlet.Could anybody please help me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dispatch Action
 
Similar Threads
Action.saveMessages
why business logic not written in Action class
fow to forward to an action from jsp ?
how to send bean objct to another jsp
Struts2 that acts as a ServletContextListener