examaction.java
来自「培训考试系统代码」· Java 代码 · 共 1,685 行 · 第 1/5 页
JAVA
1,685 行
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//查询
aplcoms.preparedQuery("");
SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetGroup" ,"1" ,"-1").getResultSet();
//把结果集存放到session中
req.setAttribute("GET-GROUP-RESULTSET",rs1);
//查询
aplcoms.preparedQuery("");
SysResultSet rs2 = aplcoms.csCommonQuery("SQL_Agt_GetExam" ,"1" ,"-1").getResultSet();
//把结果集存放到session中
req.setAttribute("GET-EXAM-RESULTSET",rs2);
//定向
return (mapping.findForward("examscoreanalyse"));
}
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();
}
}
}
/**
* 查询考试成绩,进行分析
* time :2004-05-28
* @author huangyuyuan
*/
private ActionForward queryScoreAnalyse(ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) {
//从ExamForm中获取查询条件;
String titleTerm = ( (ExamForm) form).getTitleTerm();
//String staffNoTerm = req.getParameter("staffNoTerm");
//String groupNoTerm = req.getParameter("groupNoTerm");
String startTimeTerm = ( (ExamForm) form).getStartTimeTerm();
String endTimeTerm = ( (ExamForm) form).getEndTimeTerm();
//定义连接的实例
SysDbConn aplcoms = null;
try {
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//根据查询条件,
aplcoms.preparedSP();
aplcoms.setString(1, titleTerm);
//aplcoms.setString(2, staffNoTerm);
//aplcoms.setString(3, groupNoTerm);
aplcoms.setString(2, startTimeTerm);
aplcoms.setString(3, endTimeTerm);
SysResultSet rs1 = aplcoms.csCommonSP("P_Agt_ExamGroupScoreStat").
getResultSet();
rs1.next();
aplcoms.preparedQuery(rs1.getString(1));
SysResultSet rs2 = aplcoms.csCommonQuery("SELFSQL", "1", "-1").
getResultSet();
rs2.sort(0, true);
//把结果集存放到session中
req.getSession().setAttribute("GROUP-SCORE-QUERY-RESULTSET", rs2);
//定向到列表显示页面
return (mapping.findForward("groupscorelist"));
}
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();
}
}
}
/**
* 查找失分率较高的题目
* time:2004-05-29
* @author huangyuyuan
*
*/
private ActionForward getScoreLost(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//查询
aplcoms.preparedQuery("");
SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetGroup" ,"1" ,"-1").getResultSet();
//把结果集存放到session中
req.setAttribute("GET-GROUP-RESULTSET",rs1);
//查询
aplcoms.preparedQuery("");
SysResultSet rs2 = aplcoms.csCommonQuery("SQL_Agt_GetExam" ,"1" ,"-1").getResultSet();
//把结果集存放到session中
req.setAttribute("GET-EXAM-RESULTSET",rs2);
//定向
return (mapping.findForward("examscorelost"));
}
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();
}
}
}
/**
* 查找失分率较高的题目
* time :2004-05-29
* @author huangyuyuan
*/
private ActionForward queryScoreLost(ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) {
//从ExamForm中获取查询条件;
//String titleTerm = ( (ExamForm) form).getTitleTerm();
//String staffNoTerm = req.getParameter("staffNoTerm");
//String groupNoTerm = req.getParameter("groupNoTerm");
//String startTimeTerm = ( (ExamForm) form).getStartTimeTerm();
//String endTimeTerm = ( (ExamForm) form).getEndTimeTerm();
String testTypeDis = req.getParameter("testTypeDis");
String degreeDis = req.getParameter("degreeDis");
String testMeansDis = req.getParameter("testMeansDis");
String useLevelDis = req.getParameter("useLevelDis");
String className = req.getParameter("className");
String classId = req.getParameter("classId");
//定义连接的实例
SysDbConn aplcoms = null;
try {
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//根据查询条件,
aplcoms.preparedSP();
aplcoms.setString(1, testTypeDis);
aplcoms.setString(2, degreeDis);
aplcoms.setString(3, testMeansDis);
aplcoms.setString(4, useLevelDis);
aplcoms.setString(5, classId);
SysResultSet rs1 = aplcoms.csCommonSP("P_Agt_ScoreLostQuery").
getResultSet();
rs1.next();
aplcoms.preparedQuery(rs1.getString(1));
SysResultSet rs2 = aplcoms.csCommonQuery("SELFSQL", "1", "-1").
getResultSet();
rs2.sort(0, true);
//把结果集存放到session中
req.getSession().setAttribute("SCORE-LOST-QUERY-RESULTSET", rs2);
//定向到列表显示页面
return (mapping.findForward("lostscorelist"));
}
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 deleteRecord(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//获取要删除的试题的试题号
String staffNoTerm=req.getParameter("recordid");
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
aplcoms.setString(1 ,staffNoTerm);
SysDataSet ds1 = aplcoms.csCommonSP("P_Agt_TestDel");
SysRecord rc1 = ds1.getParamSet() ;
if(rc1==null || rc1.getInt(0) == OperatorFlagCode.OPERATOR_EORROR)
{//定向到错误页面,错误号为EXAM_DELETE_ERROR;
req.setAttribute("errorId",ErrorCode.EXAM_DELETE_ERROR);
return (mapping.findForward("error"));
}
//调用queryScore函数进行重新查询后返回到考生成绩表页面
return queryScore(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();
}
}
}
// dingjiangtao 2004-6-3
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?