📄 courseregisteraction.java
字号:
/**
*******************************************************************************
* CourseAction.java
*
* (c) Copyright 2008 Hewlett-Packard Development Company, L.P.
*
*<Program Content>
* System Name : Students Management System
*<Summarize>
* The file includes a class and the class main function is to register course.
*<Update Record>
* 2009-4-29 1.00 zhangliy
*******************************************************************************
*/
package com.hp.eds.zhangliyuan.stuMan.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import com.hp.eds.zhangliyuan.stuMan.consts.PageConsts;
import com.hp.eds.zhangliyuan.stuMan.entity.UserInfo;
import com.hp.eds.zhangliyuan.stuMan.service.interf.StudentServiceInt;
/**
* The class main function is to register course.
*
* @author zhangliy
* @version 1.0
*/
public class CourseRegisterAction extends ActionSupport {
/**
* current student register course
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws Exception
* @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping,
* org.apache.struts.action.ActionForm,
* javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
UserInfo user = (UserInfo) session
.getAttribute(PageConsts.LOGIN_SUCCESS_SESSION_MASSAGE);
String userID = user.getStuId();
String classID = (String) session.getAttribute("classID");
StudentServiceInt studentService = (StudentServiceInt) this
.getWebApplicationContext().getBean("studentServiceInt");
String flg = null;
if (studentService.updateEnrol(userID, classID)) {
flg = PageConsts.COURSE_SUCCESS_PAGE;
request.setAttribute(PageConsts.COURSE_EQUEST,
PageConsts.COURSE_SUCCESS_MESSAGE);
} else {
flg = PageConsts.STUMENU_REGISTERCOU;
request.setAttribute(PageConsts.COURSE_EQUEST,
PageConsts.COURSE_FAIL_MESSAGE);
}
return mapping.findForward(flg);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -