useraction.java

来自「基于WEB的学生选课系统」· Java 代码 · 共 39 行

JAVA
39
字号
package com.student.action;import org.apache.struts.action.*;import javax.servlet.http.*;import com.student.actionform.UserActionForm;import com.student.logic.UserLogic;import com.student.vo.User;public class UserAction extends Action {  public ActionForward perform(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {    /**@todo: complete the business logic here, this is just a skeleton.*/        UserActionForm form = (UserActionForm) actionForm;        UserLogic logic = new UserLogic(form);        if(form.getOperation().equals("delete"))        {          logic.deleteUser();          form.setOperation("display");        }        if(form.getOperation().equals("save"))        {          logic.saveUser();          form.setOperation("display");        }        if(form.getOperation().equals("add"))        {           logic.addUser();           System.out.println("add a user to ====" + form.getUsers().size());           form.setOperation("display");           logic.initStudents();           logic.closeDAO();           return actionMapping.findForward("users");        }        logic.getUsers();        logic.initStudents();        logic.closeDAO();        return actionMapping.findForward("users");  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?