📄 lmanageraction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.yourcompany.struts.action;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import ms.hibernate.Popedom;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.web.page.IPagination;
import com.model.IEmpDao;
import com.model.ILogDao;
import com.model.IModuleDao;
import com.model.LogForm;
/**
* MyEclipse Struts
* Creation date: 09-21-2007
*
* XDoclet definition:
* @struts.action parameter="control" validate="true"
*/
public class LManagerAction extends DispatchAction {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
private IEmpDao empDao;
private IModuleDao moduleDao;
private ILogDao logDao;
private IPagination Pagination;
public IPagination getPagination() {
return Pagination;
}
public void setPagination(IPagination pagination) {
Pagination = pagination;
}
//连接到查询页面
public ActionForward toQeury(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession(true);
boolean b = false;
String id = (String) session.getAttribute("empid");
if (id == null) {
return mapping.findForward("login");
} else {
List<Popedom> pope = (List<Popedom>)session.getAttribute("logPope");
if (pope == null) {
request.setAttribute("error", "没有权限");
return mapping.findForward("error");
} else {
for (Iterator<Popedom> po = pope.iterator(); po.hasNext();) {
Popedom pos = po.next();
long temp = pos.getPopedomid();
if (temp == 10009) {
b = true;
break;
}
}
if (b == true) {
return mapping.findForward("queryLog");
} else {
request.setAttribute("error", "没有查询日志权限");
return mapping.findForward("error");
}
}
}
}
//查询的 action
public ActionForward query(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String cur = request.getParameter("curpage");
HttpSession session = request.getSession(true);
boolean b = false;
String id = (String) session.getAttribute("empid");
if (id == null) {
return mapping.findForward("login");
} else {
List<Popedom> pope = (List<Popedom>)session.getAttribute("logPope");
if (pope == null) {
request.setAttribute("error", "没有权限");
return mapping.findForward("error");
} else {
for (Iterator<Popedom> po = pope.iterator(); po.hasNext();) {
Popedom pos = po.next();
long temp = pos.getPopedomid();
if (temp == 10009) {
b = true;
break;
}
}
if (b == true) {
String logid = request.getParameter("id");
String empid = request.getParameter("empid");
String moduleid = request.getParameter("moduleid");
List<LogForm> list = null;
if(moduleid==null){
list = (List<LogForm>)session.getAttribute("moduleid");
}else{
list = this.getLogDao().query(logid, empid, Long.valueOf(moduleid));
session.setAttribute("moduleid", list);
}
request.setAttribute("map", this.getPagination().invoke(list, cur));
return mapping.findForward("queryResult");
} else {
request.setAttribute("error", "没有查询日志权限");
return mapping.findForward("error");
}
}
}
}
public IEmpDao getEmpDao() {
return empDao;
}
public void setEmpDao(IEmpDao empDao) {
this.empDao = empDao;
}
public IModuleDao getModuleDao() {
return moduleDao;
}
public void setModuleDao(IModuleDao moduleDao) {
this.moduleDao = moduleDao;
}
public ILogDao getLogDao() {
return logDao;
}
public void setLogDao(ILogDao logDao) {
this.logDao = logDao;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -