Struts

Struts2.0 framework Configuration File
adplus-dvertising
Previous Home Next

Introduction:

The struts2 configuration file described the all request which is send by user then configure action class will be invoked . The action class return the string this string is configure in configuration file then send the response with the help of Result class.

Class/Library File Descriptions:

There are two ways to do configuration file in struts2 framework

  1. XML based configuration file:
  2. struts.xmlM
    <struts>
    <package name=”…..”  extends=”struts-default”>
    <action name=”request submitted by user” 
    class=”action class name”>
    <result name=”string return by action class”>
    /after string return then invoke jsp page</result>
    </action> 
    </package>
    </struts>
    
  3. Java Annotation based configuration:-
  4. Action.java
    @Results({
    @Result(name="input",
    value="/RegistrationSuccess.jsp" )
    @Result(value="/RegistrationSuccess.jsp" )
    })
    public class Login implements Action {
    public String execute() {
    //Business logic for login
    }
    }
    
Previous Home Next