10.Struts2_ActionSupport

来源:互联网 发布:淘宝网男徒步凉鞋 编辑:程序博客网 时间:2024/06/03 17:42

ActionSupport

1). ActionSupport 是默认的 Action 类: 若某个 action 节点没有配置 class 属性, 则 ActionSupport 即为待执行的 Action 类. 而 execute 方法即为要默认执行的 action 方法

<action name="testActionSupport">    <result>/testActionSupport.jsp</result></action>
  • 1
  • 2
  • 3

等同于

<action name="testActionSupport"    class="com.opensymphony.xwork2.ActionSupport"    method="execute">    <result>/testActionSupport.jsp</result></action>
  • 1
  • 2
  • 3
  • 4
  • 5

2). 在手工完成字段验证, 显示错误消息, 国际化等情况下, 推荐继承 ActionSupport.

演示

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

所以,在业务稍微复杂些后,推荐使用ActionSupport。

struts-2.5.2-all.zip https://yunpan.cn/cMXkrZCZYeha7 访问密码 874b

(function () {('pre.prettyprint code').each(function () { var lines = (this).text().split(\n).length;varnumbering = $('
    ').addClass('pre-numbering').hide(); (this).addClass(hasnumbering).parent().append(numbering); for (i = 1; i