打字猴:1.700484883e+09
1700484883
1700484884 public class ActionDispather implements IActionDispather{
1700484885
1700484886 //需要执行的Action
1700484887
1700484888 private ActionManager actionManager=new ActionManager();
1700484889
1700484890 //拦截器链
1700484891
1700484892 private ArrayList<Interceptors>listInterceptors=InterceptorFactory.createInterceptors();
1700484893
1700484894 public String actionInvoke(String actionName){
1700484895
1700484896 //前置拦截器
1700484897
1700484898 return actionManager.execAction(actionName);
1700484899
1700484900 //后置拦截器
1700484901
1700484902 }
1700484903
1700484904 }
1700484905
1700484906 它是一个非常简单的类,对外部提供统一封装好的行为。模型管理器的类图如图38-6所示。
1700484907
1700484908
1700484909
1700484910
1700484911 图38-6 模型管理器类图
1700484912
1700484913 首先说ActionManager类,它负责管理所有的行为类Action,那就必须定义一个行为类的接口或抽象类,如代码清单38-13所示。
1700484914
1700484915 代码清单38-13 抽象Action
1700484916
1700484917 public abstract class ActionSupport{
1700484918
1700484919 public final static String SUCCESS=“success”;
1700484920
1700484921 public final static String FAIL=“fail”;
1700484922
1700484923 //默认的执行方法
1700484924
1700484925 public String execute(){
1700484926
1700484927 return SUCCESS;
1700484928
1700484929 }
1700484930
1700484931 }
1700484932
[ 上一页 ]  [ :1.700484883e+09 ]  [ 下一页 ]