📄 examclassaction.java
字号:
String[] examClassIds = ((ExamClassForm)form).getClassIDArr();
//以"#"号组合所要删除的,之间以"#"号分割
String examClassIdSet = Tools.getStringSet(examClassIds);
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//调用存储过程 P_Agt_ExamClassDel完成的删除
aplcoms.preparedSP();
aplcoms.setString(1 ,examClassIdSet);
SysDataSet ds = aplcoms.csCommonSP("P_Agt_ExamClassDel");
SysRecord rc = ds.getParamSet() ;
if(rc.getString(1) != null && rc.getString(1).length()>10)
{//删除部分失败
req.setAttribute("errorId",ErrorCode.EXAMCLASS_PARTDELERROR);
String backURL = "/ExamClassMan.do?opeType=" + OperatorFlagCode.EXAMCLASS_QUERY;
backURL += "&titleTerm=" + ((ExamClassForm)form).getTitleTerm();
req.setAttribute("backURL",backURL);
req.setAttribute("errorMes",rc.getString(1));
return (mapping.findForward("error"));
}
else if(rc!=null && rc.getInt(0) == OperatorFlagCode.OPERATOR_SUCCESS)
{//删除成功
//调用函数进行重新查询后返回到列表页面
return queryExamClass(mapping,form,req,res);
}
else
{
//定向到错误页面
req.setAttribute("errorId",ErrorCode.EXAMCLASS_DELETE_ERROR);
return (mapping.findForward("error"));
}
}
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 queryExamClass(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//从PolicyForm中获取查询条件;
String titleTerm = ((ExamClassForm)form).getTitleTerm();
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//根据查询条件,从数据库中获取策略记录
aplcoms.preparedQuery("");
SysResultSet rs = null;
if(titleTerm != null)
{//按照名称进行查询
aplcoms.setString(1 ,titleTerm);
rs = aplcoms.csCommonQuery("SQL_Agt_ExamManGetClassBT" ,"1" ,"-1").getResultSet();
}
else
{//查询所有
rs = aplcoms.csCommonQuery("SQL_Agt_ExamManGetClass" ,"1" ,"-1").getResultSet();
}
//把结果集存放到session中
req.getSession().setAttribute("EXAMCLASS-QUERY-RESULTSET",rs);
//定向到列表显示页面
return (mapping.findForward("examclasslist"));
}
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 queryDetailExamClass(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//从PolicyFrom中获取策略的ID号与名称
String examClassId = ((ExamClassForm)form).getExamClassId();
if(examClassId == null)
{//从列表中传过来的参数
examClassId = (((ExamClassForm)form).getExamClassIds())[0];
}
//从PolicyFrom中获取操作类型;
String opeType = ((ExamClassForm)form).getOpeType();//从form中获取
//定义连接的实例
SysDbConn aplcoms = null;
try
{
//得到一个连接的实例
aplcoms = SysConnPool.getInstance().getAplComs();
//根据策略ID号,从数据库中获取策略内容的详细信息
aplcoms.preparedQuery("");
aplcoms.setString(1 ,examClassId);
aplcoms.setInt(2 ,1);
SysResultSet rs = aplcoms.csCommonQuery("SQL_Agt_ExamManGetClassIP" ,"1" ,"-1").getResultSet();
req.setAttribute("EXAMCLASS-QUERY-IPSET1",rs);
aplcoms.preparedQuery("");
aplcoms.setString(1 ,examClassId);
aplcoms.setInt(2 ,2);
rs = aplcoms.csCommonQuery("SQL_Agt_ExamManGetClassIP" ,"1" ,"-1").getResultSet();
req.setAttribute("EXAMCLASS-QUERY-IPSET2",rs);
aplcoms.preparedQuery("");
aplcoms.setString(1 ,examClassId);
aplcoms.setInt(2 ,3);
rs = aplcoms.csCommonQuery("SQL_Agt_ExamManGetClassIP" ,"1" ,"-1").getResultSet();
req.setAttribute("EXAMCLASS-QUERY-IPSET3",rs);
aplcoms.preparedQuery("");
aplcoms.setString(1 ,examClassId);
aplcoms.setInt(2 ,4);
rs = aplcoms.csCommonQuery("SQL_Agt_ExamManGetClassIP" ,"1" ,"-1").getResultSet();
req.setAttribute("EXAMCLASS-QUERY-IPSET4",rs);
req.setAttribute("EXAMCLASSID",examClassId);
//定向
if(opeType.equalsIgnoreCase(OperatorFlagCode.EXAMCLASS_QUERY_DETAIL))
{ //定向到列表显示页面
return (mapping.findForward("examclassdetail"));
}
else
{//操作类型为查询详细信息-为了修改
return (mapping.findForward("examclassmodify"));
}
}
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -