actionroot.java
来自「spring+webwork+iBatis做的VOD系统web端代码。值得学习M」· Java 代码 · 共 106 行
JAVA
106 行
package com.hintsoft.vod.action.root;
import java.util.HashMap;
import java.util.Map;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionSupport;
/**
* ActionRoot is a based.
*/
public class ActionRoot extends ActionSupport {
private static final long serialVersionUID = 3453082753815922302L;
/**
* 当前页数
*/
protected int currentPage = 1;
/**
* 每页显示数
*/
protected int recordPage = 2;
/**
* 主键
*/
protected int mainkey = 0;
/**
* return <tt>ActionContext</tt>
*/
public ActionContext getActionContext() {
return ActionContext.getContext();
}
/**
* Set <tt>value</tt> object in session.
*/
public void setSessionAttribute(String key, Object value) {
ActionContext ac = getActionContext();
Map session = ac.getSession();
session.put(key, value);
}
/**
* Retrieves an object from session.
*/
public Object getSessionAttribute(String key) {
ActionContext ac = getActionContext();
return ac.getSession().get(key);
}
/**
* remove an object in session.
*/
public Object removeSessionAttribute(String key) {
ActionContext ac = getActionContext();
return ac.getSession().remove(key);
}
/**
* Sets a parameter in the next chained action.
*/
public void setParameter(String key, Object value) {
ActionContext ac = this.getActionContext();
Map parameters = ac.getParameters();
parameters.put(key, value);
ac.setParameters(parameters);
}
/**
* set an object in <tt>ValueStack</tt>.
*/
public void setValueStack(String key, Object value) {
Map map = new HashMap();
map.put(key, value);
ActionContext ac = this.getActionContext();
ac.getValueStack().push(map);
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getRecordPage() {
return recordPage;
}
public void setRecordPage(int recordPage) {
this.recordPage = recordPage;
}
public int getMainkey() {
return mainkey;
}
public void setMainkey(int mainkey) {
this.mainkey = mainkey;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?