摘要: 在struts2中,我们可以实现对action的所有方法进行校验或者对action的指定方法进行校验。对于输入校验struts2提供了两种实现方法:1,采用手工编写代码实现,在action中通过重写validate()方法实现,validate()方法会校验action中所有与execute()方法签名相同的方法,但是action要继承ActionSupport类。package control.center;import java.util.regex.Pattern;import com.opensymphony.xwork2.ActionContext;import com.opensy 阅读全文
posted @ 2011-02-26 16:34 魔战 阅读(510) 评论(0) 推荐(0) 编辑
摘要: 首先自定义拦截器需要实现Interceptor接口package control.center;import com.opensymphony.xwork2.ActionContext;import com.opensymphony.xwork2.ActionInvocation;import com.opensymphony.xwork2.interceptor.Interceptor;public class PersonAction implements Interceptor {@Overridepublic void destroy() {}@Overridepublic void 阅读全文
posted @ 2011-02-26 14:39 魔战 阅读(388) 评论(0) 推荐(0) 编辑