打字猴:1.7004846e+09
1700484600 //把所有的请求传递给ActionDispatcher处理
1700484601
1700484602 String result=actionDispatcher.actionInvoke(actionName);
1700484603
1700484604 String viewPath=viewManager.getViewPath(result);
1700484605
1700484606 //直接转向
1700484607
1700484608 RequestDispatcher rd=req.getRequestDispatcher(viewPath);
1700484609
1700484610 rd.forward(req,res);
1700484611
1700484612 }
1700484613
1700484614 public void init(FilterConfig arg0)throws ServletException{
1700484615
1700484616 /*
1700484617
1700484618 *1、检查XML配置文件是否正确
1700484619
1700484620 *2、启动监控程序,观察配置文件是否正确
1700484621
1700484622 */
1700484623
1700484624 }
1700484625
1700484626 //通过url获得actionName
1700484627
1700484628 private String getActionNameFromURI(HttpServletRequest req){
1700484629
1700484630 String path=(String)req.getRequestURI();
1700484631
1700484632 String actionName=path.substring(path.lastIndexOf(”/”)+1,
1700484633
1700484634 path.lastIndexOf(”.”));
1700484635
1700484636 return actionName;
1700484637
1700484638 }
1700484639
1700484640 }
1700484641
1700484642 我们按照系统的执行顺序来讲解,首先在容器的配置文件中需要配置该过滤器,以tomcat为例,配置如代码清单38-2所示。
1700484643
1700484644 代码清单38-2 核心控制器的配置
1700484645
1700484646 <?xml version=“1.0”encoding=“UTF-8”?>
1700484647
1700484648 <web-app>
1700484649
[ 上一页 ]  [ :1.7004846e+09 ]  [ 下一页 ]