Struts的工作流程

<!-- /* Font Definitions */ @font-face {font-family:"MS 明朝"; panose-1:2 2 6 9 4 2 5 8 3 4; mso-font-alt:"MS Mincho"; mso-font-charset:128; mso-generic-font-family:roman; mso-font-pitch:fixed; mso-font-signature:-1610612033 1757936891 16 0 131231 0;} @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:宋体; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:Century; panose-1:2 4 6 4 5 5 5 2 3 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:647 0 0 0 159 0;} @font-face {font-family:"/@MS 明朝"; panose-1:2 2 6 9 4 2 5 8 3 4; mso-font-charset:128; mso-generic-font-family:roman; mso-font-pitch:fixed; mso-font-signature:-1610612033 1757936891 16 0 131231 0;} @font-face {font-family:"/@SimSun"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0mm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:Century; mso-fareast-font-family:"MS 明朝"; mso-bidi-font-family:"Times New Roman"; mso-font-kerning:1.0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:99.25pt 30.0mm 30.0mm 30.0mm; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:18.0pt;} div.Section1 {page:Section1;} -->

工作机制:
Struts 的工作流程 :
web 用启 动时 就会加 初始化 ActionServlet,ActionServlet
struts-config.xml 文件中 取配置信息 , 把它 存放到各 配置
ActionServlet 接收到一个客 户请 , 行如下流程 .
-(1) 索和用 户请 求匹配的 ActionMapping , 如果不存在 , 就返回 求路径无效信息 ;
-(2) 如果 ActionForm 例不存在 , 建一个 ActionForm , 把客 提交的表 数据保存到 ActionForm 象中 ;
-(3) 根据配置信息决定是否需要表 单验证 . 如果需要 验证 , ActionForm validate() 方法 ;
-(4) 如果 ActionForm validate() 方法返回 null 或返回一个不包含 ActionMessage ActuibErrors , 就表示表 单验证 成功 ;
-(5)ActionServlet 根据 ActionMapping 所包含的映射信息决定将 转发给 哪个 Action, 如果相 Action 例不存在 , 就先 , 然后 Action execute() 方法 ;
-(6)Action execute() 方法返回一个 ActionForward ,ActionServlet 在把客 户请 转发给 ActionForward 象指向的 JSP ;
-(7)ActionForward 象指向 JSP 件生成 动态 , 返回 ;

要用:
JSP Servlet JavaBean 的出 现给 构建 大的企 业应 用系 提供了可能。 但用 些技 构建的系 非常的繁乱,所以在此之上,我 需要一个 规则 、一个把 些技 术组织 起来的 规则 就是框架, Struts 便 运而生。

基于 Struts 开发 用由 3 类组 件构成:控制器 件、模型 件、 视图组

8 Struts validate 框架是如何 验证 的?
struts 配置文件中配置具体的 错误 提示,再在 FormBean 中的 validate() 方法具体 用。

9 Struts 设计 模式
MVC 模式 : web 用程序启 动时 就会加 并初始化 ActionServler 。用 提交表 单时 ,一个配置好的 ActionForm 象被 建,并被填入表 的数 据, ActionServler 根据 Struts-config.xml 文件配置好的 置决定是否 需要表 单验证 ,如果需要就 ActionForm Validate () 验证 选择 送到哪个 Action ,如果 Action 不存在, ActionServlet 会先 象,然后 Action execute ()方法。 Execute ()从 ActionForm 象中 取数据,完成 业务逻辑 ,返回一个 ActionForward 象, ActionServlet 再把客 户请 转发给 ActionForward 象指定的 jsp 件, ActionForward 象指定的 jsp 生成 的网 ,返回

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值