学习Action的几个内容1.实现一个Action的最常用方式: 从ActionSupport继承 链接2.Action配置 DMI动态方法调用 ! 通配符配置 * {1} {2} … *_* 链...
分类:
其他好文 时间:
2014-12-05 22:38:09
阅读次数:
179
相应的action,在action中实例化了许多需要传递给客户端的参数public class OgnlAction extends ActionSupport { private Cat cat = new Cat(); private Map dogMap = new HashMap...
分类:
其他好文 时间:
2014-12-05 16:59:30
阅读次数:
218
四种方法设置返回时的参数(一)import java.util.Map;import com.opensymphony.xwork2.ActionContext;import com.opensymphony.xwork2.ActionSupport;public class LoginAction...
分类:
其他好文 时间:
2014-12-05 15:28:41
阅读次数:
189
文字 package com.myeclipseide.example.myblog.secure; import com.opensymphony.xwork2.ActionSupport; public class AuthenticateUser extends ActionSupport {...
方法: 1.在Action类中execute()方法中进行校验。 优点:Action类无需继承框架中的类。 缺点:(1)当有多个校验时,代码重复,违反高内聚,低耦合。 2.重写框架ActionSupport类中的validate()方法。 优点:包含this.addFieldE...
分类:
其他好文 时间:
2014-11-30 23:02:19
阅读次数:
155
??
SPring+Structs2实现的项目中进行Spring AOP时的相关小记
1.一般为了方便开发Structs2的项目中的action都会建立一个BaseAction如果继承了BaseAction中的子类进行AOP时,只能指定AOP中的PointCut为BaseAction
如果对应的BaseAction如果继承于ActionSupport的话,就只能定义AOP中的PointCut...
分类:
编程语言 时间:
2014-11-06 13:02:33
阅读次数:
210
struts2手动验证:* 首先要从页面中获取对应的标签name属性的值,在动作类action中声明同名的属性,提供get和set方法* 要继承ActionSupport类或者实现Validateable接口* 重写Validateable接口的validate()方法* 前提是:要保证setUse...
分类:
其他好文 时间:
2014-11-04 10:57:36
阅读次数:
187
有时我们需要对Action中注入的字段进行校验,这时我们就需要用到invidate()方法了。
首先需要Action实现ActionSupport,然后重写invidate()方法,在其中对字段进行校验。
如果校验合法,则执行action中的相应方法(一般为execute),请求转发到相应的jsp;
如果校验失败,可以通过addFieldError()方法将错误信息添加到FieldError...
分类:
其他好文 时间:
2014-11-02 16:30:41
阅读次数:
232
struts2框架运行时,默认执行action类中的execute()方法,在action标签中在继承ActionSupport的类中自定义方法,由public来修饰的必须是String返回类型不能传参数方法名自定义总之一句话,除了方法名誉execute()不一样,其他所有的内容都一样。通配符,匹配...
分类:
其他好文 时间:
2014-11-01 13:05:54
阅读次数:
223
方法:1.使用 Spring 的 ActionSupport 类整合 Structs2.使用 Spring 的 DelegatingRequestProcessor 覆盖 Struts 的 RequestProcessor3.将 Struts Action 管理委托给 Spring 框架无论您使用哪...
分类:
编程语言 时间:
2014-10-28 19:53:41
阅读次数:
208