scoremanaction.java
来自「培训考试系统代码」· Java 代码 · 共 524 行 · 第 1/2 页
JAVA
524 行
aplcoms.setString(4 ,paperId);
aplcoms.setString(5 ,replyStaffNo);
aplcoms.setString(6 ,examTime);
SysDataSet ds1 = aplcoms.csCommonSP("P_Agt_ScoreDeal");
SysRecord rc1 = ds1.getParamSet();
if(rc1==null || rc1.getInt(0) == OperatorFlagCode.OPERATOR_EORROR)
{
//定向到出错页面,错误号为:SCOREMAN_DEAL_ERROR
req.setAttribute("errorId",ErrorCode.SCOREMAN_DEAL_ERROR);
return (mapping.findForward("error"));
}
//显示结果页面
req.setAttribute("score",String.valueOf(rc1.getInt(1)));
req.setAttribute("totalScore",String.valueOf(rc1.getInt(2)));
return (mapping.findForward("scoreresult"));
// ((ScoreManForm)form).setOpeType(req.getParameter("opeTypeQuery"));
// return getScoreList(mapping,form,req,res);
}
catch (SysDbException aple)
{//捕获CommonService系统异常,定向到出错页面
//输出异常信息
aple.printStackTrace();
req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
return (mapping.findForward("error"));
}
catch(java.sql.SQLException sqle)
{//捕获调用aplcoms异常,定向到出错页面
// 输出异常信息
sqle.printStackTrace();
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{//捕获未知异常,定向到出错页面
//输出异常信息
e.printStackTrace();
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
{//关闭连接实例
if(aplcoms != null)
{
aplcoms.close();
}
}
}
/**
* 获取答卷的名称,作为查询条件
*/
private ActionForward getExamName(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//从Session中获取工号
String staffNo = (String)req.getSession().getAttribute("workerNo");
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//根据考试记录ID号获取所评阅考卷的试题信息
aplcoms.preparedQuery("");
aplcoms.setString(1, staffNo);
SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_ScoreManGetExam" ,"1" ,"-1").getResultSet();
//把结果集传送到页面
req.setAttribute("SCOREMAN-GET-EXAMSET",rs1);
//定向到列表显示页面
return (mapping.findForward("scoremansearch"));
}
catch (SysDbException aple)
{//捕获CommonService系统异常,定向到出错页面
//输出异常信息
aple.printStackTrace();
req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
return (mapping.findForward("error"));
}
catch(java.sql.SQLException sqle)
{//捕获调用aplcoms异常,定向到出错页面
// 输出异常信息
sqle.printStackTrace();
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{//捕获未知异常,定向到出错页面
//输出异常信息
e.printStackTrace();
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
{//关闭连接实例
if(aplcoms != null)
{
aplcoms.close();
}
}
}
///:huangyuyuan add 2004-06-03
/**
* 获取已经评阅的试卷列表
*/
private ActionForward getScoreModifyList(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//获取操作类型
String opeType = ((ScoreManForm)form).getOpeType();//从form中获取
//从Session中获取工号
String staffNo = (String)req.getSession().getAttribute("workerNo");
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
SysResultSet rs2 = null;
if(opeType.equalsIgnoreCase(OperatorFlagCode.SCOREMAN_MODIFY_QUERY))
{
aplcoms.preparedSP();
aplcoms.setString(1,req.getParameter("title"));
aplcoms.setString(2,staffNo);
aplcoms.setString(3,req.getParameter("replyer"));
SysResultSet rs1 = aplcoms.csCommonSP("P_AGT_SCOREMODIFYQUERY").getResultSet();
rs1.next();
aplcoms.preparedQuery(rs1.getString(1));
rs2 = aplcoms.csCommonQuery("SELFSQL","1","-1").getResultSet();
}
else
{
//根据工号从数据库中获取评阅考卷列表记录
aplcoms.preparedSP();
aplcoms.setString(1,"");
aplcoms.setString(2,staffNo);
aplcoms.setString(3,"");
SysResultSet rs1 = aplcoms.csCommonSP("P_AGT_SCOREMODIFYQUERY").getResultSet();
rs1.next();
aplcoms.preparedQuery(rs1.getString(1));
rs2 = aplcoms.csCommonQuery("SELFSQL","1","-1").getResultSet();
}
//把结果集存放到session中
req.getSession().setAttribute("SCOREMAN-MODIFY-RESULTSET",rs2);
//定向到列表显示页面
return (mapping.findForward("scoremodifylist"));
}
catch (SysDbException aple)
{//捕获CommonService系统异常,定向到出错页面
//输出异常信息
aple.printStackTrace();
req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
return (mapping.findForward("error"));
}
catch(java.sql.SQLException sqle)
{//捕获调用aplcoms异常,定向到出错页面
// 输出异常信息
sqle.printStackTrace();
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{//捕获未知异常,定向到出错页面
//输出异常信息
e.printStackTrace();
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
{//关闭连接实例
if(aplcoms != null)
{
aplcoms.close();
}
}
}
/**
* 获取重新评卷的试题信息
*/
private ActionForward getScoreModifyDetail(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//获取记录ID号
String recordId = ((ScoreManForm)form).getRecordId();
//获取该考试记录的试卷的ID号
String paperId = ((ScoreManForm)form).getPaperId();
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//根据考试记录ID号获取所评阅考卷的试题信息
aplcoms.preparedQuery("");
aplcoms.setString(1, recordId);
aplcoms.setString(2, paperId);
SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_ScoreManModifyDetail" ,"1" ,"-1").getResultSet();
//传送参数
req.setAttribute("recordId",recordId);
req.setAttribute("paperId",paperId);
//把结果集传送到页面
req.setAttribute("SCOREMAN-GET-DETAILSET",rs1);
//定向到列表显示页面
return (mapping.findForward("scoremodifydetail"));
}
catch (SysDbException aple)
{//捕获CommonService系统异常,定向到出错页面
//输出异常信息
aple.printStackTrace();
req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
return (mapping.findForward("error"));
}
catch(java.sql.SQLException sqle)
{//捕获调用aplcoms异常,定向到出错页面
// 输出异常信息
sqle.printStackTrace();
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{//捕获未知异常,定向到出错页面
//输出异常信息
e.printStackTrace();
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
{//关闭连接实例
if(aplcoms != null)
{
aplcoms.close();
}
}
}
///:~
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?