aspose file tools*
The moose likes Struts and the fly likes Struts 2 newbie - returned String. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 newbie - returned String." Watch "Struts 2 newbie - returned String." New topic
Author

Struts 2 newbie - returned String.

Swerrgy Smith
Ranch Hand

Joined: Mar 26, 2010
Posts: 91
Hello,

I have an action class like below:



Is there any problem with this code when the execute() function is invoked?
I wonder if doOther() function will be executed or not? After the doSomething() function return a String, whether the correspondent output will be displayed immediately or not?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

doOther will be executed. After Struts calls your execute method, Struts will only take matters into its hands after you return a String from the execute method itself. Your call to doSomething doesn't matter to Struts. The last line of the execute method will return str to Struts and after that Struts will send the corresponding result to the client. The output will only be displayed after the execute method has completed i.e. not immediately after doSomething method completes...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Swerrgy Smith
Ranch Hand

Joined: Mar 26, 2010
Posts: 91
Thank you very much, Ankit Garg
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 newbie - returned String.