`
itlangzicn
  • 浏览: 38474 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

struts流程

阅读更多

1.页面提交 *.do 请求到web.xml文件中的<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>中去给ActionServlet类
 2.ActionServlet类调用根据请求方式调用本类中doGet或doPost方法(下面是ActionServlet类的doGet方法)
       public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws IOException, ServletException {
         process(request, response);
     }
 3.在这方法中又去调用ActionServlet类中的process方法(下面是ActionServlet的process方法)
    protected void process(HttpServletRequest request,
         HttpServletResponse response)
         throws IOException, ServletException {
         ModuleUtils.getInstance().selectModule(request, getServletContext());
         ModuleConfig config = getModuleConfig(request);
         RequestProcessor processor = getProcessorForModule(config);
         if (processor == null) {
             processor = getRequestProcessor(config);
         }
         processor.process(request, response);
     }
 4.在这个方法中又去调用RequestProcessor类的 processor方法
      ①    得到servletpath
        String path = processPath(request, response);
      ②   根据servletpath得到ActionMapping
         ActionMapping mapping = processMapping(request, response, path);
      ③    根据ActionMapping得到ActionForm
         ActionForm form = processActionForm(request, response, mapping);
      ④   若配置类 action 的 validate 属性为 true, 或使用默认值则. 调用 ActionForm 的 validate() 方法进行简单验证:
   
    if (!processValidate(request, response, form, mapping)) {
                 return;
             }
            
             若验证没有通过, 将页面派发到 input 属性指定的页面. 方法结束, 此时请求不会到达 Action
     ⑤   验证通过后再根据ActionMapping得到Action
        Action action = processActionCreate(request, response, mapping);
     ⑥  根据Action、ActionForm、ActionMapping得到ActionForward
        ActionForward forward = processActionPerform(request, response, action, form, mapping);
     ⑦  在processActionPerform方法中调用Action中的execute方法返回ActionForward
     
     ⑧  调用processForwardConfig(request, response, forward);来页面转发
    
    
 简单来讲就是:
          页面提交 *.do 到web.xml文件中的ActionServlet类中---->ActionServlet类根据请求方式调用doGet,doPost方法---->doGet,doPost方法有调用ActionServlet的process方法--->
   ActionServlet的process方法又去调用RequestProcessor中的 processor方法---->在RequestProcessor中的 processor方法中完成操作


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/itlangzicn/archive/2009/12/30/5102372.aspx

分享到:
评论
2 楼 guanzhongdaoke54007 2011-11-10  
好复杂。。
1 楼 浪客剑心 2010-02-02  
呵呵 清晰的原理,谢谢了

相关推荐

    struts流程图struts流程图

    struts流程图struts流程图struts流程图struts流程图

    最详细的struts流程图

    最详细的struts流程图 最详细的struts流程图 最详细的struts流程图

    struts 流程

    描述struts 流程,通过分析其流程更好的掌握struts

    Struts流程应用配置及定制标签.rar

    1.Struts流程描述.ppt 1-2.Struts应用.ppt 2-1.Struts的工作流程.ppt 2-2.JSP文件解析.ppt 2-3.struts实验1.ppt 2-4.struts实验2.ppt 3.struts控制器.ppt 3.配置struts.ppt

    struts流程图

    对于struts的了解能够更系统和逻辑,希望能多多学习..

    Struts2 基本流程

    我们已在前面学习了Servlet 数据库应用,有了JSP、Servlet 、JDBC的一些知识、理解和...2. Struts2基本流程 3. 了解核心控制器FilterDispatcher及在web.xml中的配置 4. 了解业务控制器Action及在struts.xml中的配置

    Struts运行流程图(详细)

    底层,详细. Struts运行流程图(详细) Struts运行流程图(详细) Struts运行流程图(详细)

    Struts工作流程

    Struts工作流程

    Struts2工作流程图

    虽然Struts2号称是一个全新的框架,但这仅仅是相对Struts 1而言。Struts 2 与Struts 1相比,确实有很多革命性的改进,但它并不是新发布的新框架,而是在另一个赫赫有名的框架:WebWork基础上发展起来的。从某种程度...

    Struts 原理 流程图

    Struts 原理 流程图Struts 原理 流程图

    struts2流程与流程图

    一个请求在Struts 2框架中的处理大概分为以下几个步骤。  客户端提交一个(HttpServletRequest)请求,如上文在浏览器中输入 http://localhost: 8080/bookcode/ch2/Reg.action就是提交一个(HttpServletRequest)...

    struts业务流程图

    非常明确的,清晰明了的struts 业务流程图,把图看懂了就懂struts了。

    struts-hibernate参考文档

    struts流程 struts流程 ,并在2004年3月成为ASF的顶级项目。它通过采用JavaServlet/JSP技术,实现了基于Java EEWeb应用的MVC设计模式的应用框架,是MVC经典设计模式中的一个经典产品 Hibernate是一个开放源代码的...

    struts实现流程

    struts流程,个人的一点总结,各位将就着看吧

    超详细struts2执行流程图

    这张流程图 深刻的描述了 struts2的执行流程 帮助了解Struts2

    Struts简介 什么是Struts Struts基本运作流程

    Struts简介 什么是Struts Struts基本运作流程 ActionMapping类 Action类 ActionForm类 ActionError与ActionMessage 协同开发 模块化程序 Struts异常处理 Struts国际化支持 PlugIn接口 等等

    最详细的Struts工作流程图

    这是一个详细的Struts工作流程图,里面包含JSP、java(Action、ActionForm等)类

    struts工作流程.doc

    1. 客户端发送一个请求,...2. ActionSevlet首先调用struts配置文件(struts-config.xml),如果有表单提交,需要自动填充ActionForm Bean(找struts配置文件的),根据请求分派给相应的Action(找struts配置文件的)。

    Struts2工作流程

    Struts2的工作流程及struts2配置文件中各属性的含义

Global site tag (gtag.js) - Google Analytics