Guest User

Untitled

a guest
Feb 28th, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. [1] ACTION class
  2.  
  3. package xxx.actions.yyy;
  4.  
  5. import org.apache.log4j.Logger;
  6. import org.apache.struts2.convention.annotation.Action;
  7. import org.apache.struts2.convention.annotation.Actions;
  8. import org.apache.struts2.convention.annotation.Namespace;
  9. import org.apache.struts2.convention.annotation.Result;
  10.  
  11. import com.opensymphony.xwork2.ActionSupport;
  12.  
  13. @Namespace("/test")
  14. public class HelloWorldAction extends ActionSupport {
  15.  
  16.     public String getYourName() {return yourName; }
  17.     public void setYourName(String value) {this.yourName = value;}
  18.  
  19.     @Actions({
  20.         @Action(value="{yourName}", results={@Result(location = "test.jsp")}),
  21.         @Action(value="put", results={@Result(location = "test.jsp")})
  22.     })
  23.     public String execute() {
  24.         yourName = "Hello " +  yourName + " !";
  25.         logger.debug("execute: " + yourName);
  26.         return SUCCESS;
  27.     }
  28.  
  29.     private static final long serialVersionUID = 1L;
  30.     private String yourName;
  31.     private static Logger logger = Logger.getLogger(HelloWorldAction.class);
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment