Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [1] ACTION class
- package xxx.actions.yyy;
- import org.apache.log4j.Logger;
- import org.apache.struts2.convention.annotation.Action;
- import org.apache.struts2.convention.annotation.Actions;
- import org.apache.struts2.convention.annotation.Namespace;
- import org.apache.struts2.convention.annotation.Result;
- import com.opensymphony.xwork2.ActionSupport;
- @Namespace("/test")
- public class HelloWorldAction extends ActionSupport {
- public String getYourName() {return yourName; }
- public void setYourName(String value) {this.yourName = value;}
- @Actions({
- @Action(value="{yourName}", results={@Result(location = "test.jsp")}),
- @Action(value="put", results={@Result(location = "test.jsp")})
- })
- public String execute() {
- yourName = "Hello " + yourName + " !";
- logger.debug("execute: " + yourName);
- return SUCCESS;
- }
- private static final long serialVersionUID = 1L;
- private String yourName;
- private static Logger logger = Logger.getLogger(HelloWorldAction.class);
- }
Advertisement
Add Comment
Please, Sign In to add comment