Home Struts Struts Struts2.2.1 Introduction to Action interface

Ask Questions?

View Latest Questions


 
 

Introduction to Action interface
Posted on: November 23, 2010 at 12:00 AM
Advertisement
In this tutorial you will learn about the struts Action interface, its methods and fields

Introduction To Struts Action Interface

The Action interface contains the a single method execute(). The business logic of the action is executed within this method. This method is implemented by the derived class. For example

public String execute() throws Exception {
        setMessage(getText(ACTIONMESSAGE));
        // Some Bussiness Logic
		return SUCCESS;
    }

It also contains the fields SUCCESS, NONE, ERROR, INPUT, and LOGIN.

SUCCESS- This is a string and it is returned  when operation is success full.

INPUT- This field is uses when the application requires default form.

ERROR- This field is used when application execution is failure. Generally it forwarded to the view which representing the error message.

LOGIN- When application need login from the user then this field is used. It forwarded to the login view to get login from user.

NONE- If the execution of action is successful but you do not want to show any view then this field is used.

Related Tags for Introduction to Action interface:


DMCA.com