package com.pb.web.action;/* * 創建普通的java類 */public class HelloAction1 { public String execute(){ return "success"; }}二、實現Action接口package com.pb.web.action;import com.opensymphony.xwork2.Action;/* * 第二種實現Action接口 */public class HelloAction2 implements Action { @Override public String execute() throws Exception { // TODO Auto-generated method stub return "success"; }}三、繼承ActionSupportpackage com.pb.web.action;import com.opensymphony.xwork2.ActionSupport;/* * 第三種 繼承 ActionSupport類它是Action的實現類 */public class HelloAction3 extends ActionSupport { /** * */ PRivate static final long serialVersionUID = 1L; @Override public String execute() throws Exception { // TODO Auto-generated method stub return "success"; } }新聞熱點
疑難解答