📄 accountaction.java
字号:
package com.set.system.struts.action;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.set.appframe.data.GenericValueObject;
import com.set.appframe.data.SearchResult;
import com.set.appframe.exception.SystemException;
import com.set.appframe.web.MyBaseAction;
import com.set.system.business.AccountMgr;
import com.set.system.model.AccountVO;
import com.set.system.model.UsersVO;
import com.set.utils.DateTimeUtils;
import com.set.utils.WebUtils;
public class AccountAction extends MyBaseAction {
/**
* 用户注册保存数据
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward regist(ActionMapping mapping, ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) {
AccountVO vo=new AccountVO(WebUtils.convertEnumeration(request));
UsersVO uservo=new UsersVO();
uservo.setUsername(vo.getItemString("USERNAME"));
uservo.setPassword(vo.getItemString("PASSWORD"));
try {
AccountMgr mgr=(AccountMgr)getBean("AccountMgr");
mgr.create(vo,uservo);
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
request.setAttribute("account", vo);
return mapping.findForward("view");
}
public ActionForward getAccount(ActionMapping mapping, ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) {
GenericValueObject vo=new GenericValueObject();
String key=request.getParameter("key");
String userid=(String)request.getSession().getAttribute("ID");
try {
AccountMgr mgr=(AccountMgr)getBean("AccountMgr");
vo=mgr.getByUserid(userid);
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String createdDate=vo.getItemString("CREATEDDATE");
if (!"0".equals(createdDate) && !"".equals(createdDate)) {
vo.add("CREATEDDATE", DateTimeUtils.long2DateString(createdDate));
}
request.setAttribute("account", vo);
if(key.equals("view")){
return mapping.findForward("viewaccount");
}else{
return mapping.findForward("edit");
}
}
public ActionForward modify(ActionMapping mapping, ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) {
AccountVO vo = new AccountVO(WebUtils.convertEnumeration(request));
try {
AccountMgr manager = (AccountMgr) getBean("AccountMgr");
vo = manager.update(vo);
} catch (SystemException e) {
}
String createdDate=vo.getItemString("CREATEDDATE");
if (!"0".equals(createdDate) && !"".equals(createdDate)) {
vo.add("CREATEDDATE", DateTimeUtils.long2DateString(createdDate));
}
request.setAttribute("account", vo);
return mapping.findForward("editsuccess");
}
public ActionForward modifyPassword(ActionMapping mapping, ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) {
UsersVO vo = new UsersVO(WebUtils.convertEnumeration(request));
String id=(String)request.getSession().getAttribute("ID");
vo.setId(id);
try {
AccountMgr manager = (AccountMgr) getBean("AccountMgr");
vo = manager.updatePassword(vo);
} catch (SystemException e) {
}
request.getSession().setAttribute("PASSWORD", vo.getPassword());
request.setAttribute("message", "1");
return mapping.findForward("modifysuccess");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -