enterexamaction.java

来自「采用Eclispe开发平台」· Java 代码 · 共 59 行

JAVA
59
字号
package com.whatratimes.webedu.student;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.Action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Hashtable;

/**
 * User: Tao
 * Date: Jun 15, 2003
 * Time: 7:06:48 AM
 */
public class EnterExamAction extends Action
{
    public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
    {
        String assign_id = httpServletRequest.getParameter("AssignmentId");

        if (assign_id == null)
        {
            return actionMapping.findForward("back");
        }

        Hashtable this_assign = null;

        HttpSession session = httpServletRequest.getSession();

        Object[] objs = (Object[]) session.getAttribute("ExamTable");

        for (int i = 0; i < objs.length; i++)
        {
            Hashtable h = (Hashtable) objs[i];
            if (Integer.valueOf(assign_id).equals(h.get("AssignmentId")))
            {
                this_assign = h;
                break;
            }
        }

        if ( this_assign == null )
        {
            return actionMapping.findForward("back");
        }

        session.setAttribute("CurrentAssignment", this_assign);

        httpServletResponse.setHeader("Cache-Control","no-cache");
        httpServletResponse.setHeader("Pragma","no-cache");
        httpServletResponse.setDateHeader ("Expires", 0);

        return actionMapping.findForward("success");
    }
}

⌨️ 快捷键说明

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