📄 stuaction.java
字号:
package cn.stu;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import cn.dao.UserinfoDatabase;
import cn.login.PJBaseAction;
import cn.login.PJBaseForm;
public class StuAction extends PJBaseAction {
@Override
public ActionForward doAction(ActionMapping mapping, PJBaseForm form, HttpServletRequest req, HttpServletResponse res) throws Exception {
ActionForward moveTo = mapping.getInputForward();
StuForm myform = (StuForm)form;
HttpSession s = req.getSession();
ArrayList<String> loginInfo= (ArrayList) s.getAttribute("loginUser");
if(loginInfo==null){
moveTo=mapping.findForward("login");
}else{
if("tuichu".equals(myform.getActType())){
s.removeAttribute("loginUser");
moveTo=mapping.findForward("login");
}else if("xiugai".equals(myform.getActType())){
s.setAttribute("xiugai",loginInfo.get(0));
moveTo=mapping.findForward("xiugai");
}else{
UserinfoDatabase ud = new UserinfoDatabase(myform.getConn());
ArrayList<String> info = ud.select(loginInfo.get(0),loginInfo.get(1));
myform.setUsername(info.get(0));
myform.setPassword(info.get(1));
myform.setSex(info.get(2));
myform.setTel(info.get(3));
myform.setMail(info.get(4));
myform.setSchool(info.get(5));
myform.setXingqu(info.get(6));
myform.setJianjie(info.get(7));
}
}
return moveTo;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -