2014年6月3日
摘要: 1 1、手工编程验证,针对该动作类中的所有的动作方法2 步骤:3 a、动作类继承ActionSupport4 b、覆盖调用public void validate()方法5 c、在validate方法中,编写不符合要求的代码判断,并调用父类的addFieldE... 阅读全文
posted @ 2014-06-03 21:49 wf110 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 1 2 1、编写一个类,实现com.opensymphony.xwork2.interceptor.Interceptor 3 2、主要实现public String intercept(ActionInvocation invocation) throws Exception{... 阅读全文
posted @ 2014-06-03 20:32 wf110 阅读(679) 评论(0) 推荐(0) 编辑
摘要: 注意点 private File image;//对应的就是表单中文件上传的那个输入域的名称,Struts2框架会封装成File类型的 private String imageFileName;// 上传输入域FileName 文件名 private String im... 阅读全文
posted @ 2014-06-03 19:44 wf110 阅读(5301) 评论(0) 推荐(0) 编辑
摘要: ActionContext 获取 域引用的mapServletActionContext获取具体域对象//域范围 ActionContext ac = ActionContext.getContext(); Map applicationMap = ac.getAppli... 阅读全文
posted @ 2014-06-03 19:05 wf110 阅读(3769) 评论(0) 推荐(0) 编辑
摘要: 1 一、自定义类型转换器 2 1、编写一个类,继承com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter 3 2、覆盖掉其中的public Object convertValue(Map context, Objec... 阅读全文
posted @ 2014-06-03 18:27 wf110 阅读(1300) 评论(0) 推荐(0) 编辑
摘要: 1 2 3 /success.jsp4 其它包 extends="mypackage" 就可以用到它里面的参数了常量1 2 3 4 5 6 struts2中每个请求都局部创建一个变量执... 阅读全文
posted @ 2014-06-03 14:36 wf110 阅读(1109) 评论(0) 推荐(0) 编辑
摘要: struts就是充当拦截器(过滤器)的作用。在web.xml配置过滤器, 1 package cn.itcast.framework.core; 2 3 import java.io.IOException; 4 import java.lang.reflect.Method; 5 im... 阅读全文
posted @ 2014-06-03 10:55 wf110 阅读(2642) 评论(0) 推荐(0) 编辑
摘要: 一、分析之前的项目的不足,编写属于自己的框架二、Struts2简介(面试)三、搭建Struts2的开发环境 1、找到所需的jar包:发行包的lib目录中(不同版本需要的最小jar包是不同的,参见不同版本的文档。2.1.7)去apps中找例子拷贝jar包 2、在应用的WEB-INF/classes... 阅读全文
posted @ 2014-06-03 10:50 wf110 阅读(290) 评论(0) 推荐(0) 编辑