Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Coding the configuration

Code Block
xml
xml
titleactionstruts.xml
<!DOCTYPE xworkstruts PUBLIC
    "-//OpenSymphonyApache Software GroupFoundation//XWork 1DTD Struts Configuration 2.0//EN"
    	"http://wwwstruts.opensymphonyapache.comorg/xworkdtds/xworkstruts-12.0.dtd">

<xwork><struts>
  <include file="action-default.xml" />

  <package name="default" extends="action-default">
     <interceptors>
       <interceptor name="greeting" class="tutorial.GreetingInterceptor" />
     </interceptors>

     <action name="greeting" class="tutorial.GreetingAction">
 	<interceptor-ref name="greeting" />
 	<result name="success" type="velocity">greeting.vm</result>
      </action>

      <!-- other action mappings -->

   </package>
 </xwork>struts>

Coding the Action class

Code Block
java
java
titleGreetingAction.java
package tutorial;

import com.opensymphony.xwork.ActionSupport;

public class GreetingAction extends ActionSupport {
  public String execute() throws Exception
  {
    return SUCCESS;
  }
}

...