File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Is execute() method always executed? (Struts 1) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is execute() method always executed? (Struts 1)" Watch "Is execute() method always executed? (Struts 1)" New topic

Is execute() method always executed? (Struts 1)

Swerrgy Smith
Ranch Hand

Joined: Mar 26, 2010
Posts: 93
Hello all,

I know that we can configure in struts-config.xml so that when we click in an URL, a specific method in action class will be executed instead of the default execute() method. However, I would like to know if the execute() method is always executed before that specific method?

For example, if we have a configuration like below:

When we click in an URL with the parameter method=specificMethod, I know that the specificMethod() will be executed. But whether the execute() method is executed before this specific method is invoked()?

Thank you very much.
David Newton

Joined: Sep 29, 2008
Posts: 12617

Yes--that's how it finds the method to call. The DispatchActions override execute(), read the parameter, and call the appropriate method.

Sometimes it's quicker to just check the source code first--one of the advantages of an open-source project is that you don't have to wait for answers! :)
I agree. Here's the link:
subject: Is execute() method always executed? (Struts 1)
It's not a secret anymore!