首页>代码>Struts2.3.5+Hibernate3+Spring3.1基于注解实现的多文件上传,下载>/FileUploadDownLoad/FileUploadDownLoad/src/cn/gov/csdn/base/action/BaseAction.java
package cn.gov.csdn.base.action; import java.lang.reflect.ParameterizedType; import org.apache.struts2.convention.annotation.ParentPackage; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; import com.opensymphony.xwork2.Preparable; /** * File: BaseAction.java * Author: admin * Version: 1.0 * Date: 2014/01/02 15:33 * Modify: * Description:用于继承 * Copyright csdn */ //这个值是定义在XML里的拓展包 @ParentPackage("basePackage") //实现Preparable为了给模型在传给页面之前赋值 public class BaseAction<T> extends ActionSupport implements Preparable, ModelDriven<T> { private static final long serialVersionUID = -1314560516485837572L; public int offset = 10;// 每页显示记录数 public int pageNo = 1; // 接收页号 public T model; private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } @SuppressWarnings( { "rawtypes", "unchecked" }) public BaseAction() { try { ParameterizedType type = (ParameterizedType) this.getClass() .getGenericSuperclass(); Class clazz = (Class) type.getActualTypeArguments()[0]; model = (T) clazz.newInstance(); } catch (Exception e) { e.printStackTrace(); } ThreadLocal thread = new ThreadLocal(); thread.set(offset); } public void prepare() throws Exception { } public T getModel() { return model; } }

597117933 LV9
2020年12月17日
17704627276 LV17
2020年10月19日
annazhang LV29
2020年7月19日
lwp011 LV27
2020年7月7日
1404002391 LV12
2020年5月20日
912299793 LV21
2020年5月15日
angujj LV1
2020年3月23日
13148918399 LV9
2019年12月10日
592381035 LV1
2019年12月5日
hzhsh0223 LV18
2019年9月18日