File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts2- About the return type on to the execute Method in Action class 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 "Struts2- About the return type on to the execute Method in Action class" Watch "Struts2- About the return type on to the execute Method in Action class" New topic
Author

Struts2- About the return type on to the execute Method in Action class

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234


Hi ,

As per a tutorial on one of the site :

INPUT is returned when the action requires more input from the user.


I did not understand the above Point .


(As per my understanding INPUT is applicable when we are doing validation inside the execute Method itself , please correct me if i am wrong)
Can anybody please tell me when should i use return type as "INPUT" inside the execute method of an Action class ??


Save India From Corruption - Anna Hazare.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Generally validation is not handled inside the execute method so you don't need to return input from the execute method. If you use struts 2 validation (info here) or use a simple validate method (example) for your data, then the validation interceptor will validate your data and if there are any validation errors, then the workflow interceptor will automatically send you to the input page...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

As an example, "input" might be returned if a requested resource isn't found, allowing the user to re-enter search information.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you Ankit and David.
 
 
subject: Struts2- About the return type on to the execute Method in Action class
 
Similar Threads
When is the class that extends ActionForm executed
Validation error mesage is not display in browser
saveToken() without html:form?
Predefined Names used inside the Struts2.xml file
Struts 2 - wrong method executed