📄 u05a201action.java
字号:
package cn.hope.mana.action;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import cn.hope.mana.bo.U05BO;
import cn.hope.mana.form.U05A201Form;
import cn.hope.mana.pojo.TQuestion;
import cn.hope.mana.pojo.U07CommonListVO;
import cn.hope.mana.pojo.dao.TTestDAO;
public class U05A201Action extends DispatchAction {
public ActionForward search(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
U05BO u05bo = new U05BO();
Integer SSid = (Integer) request.getSession().getAttribute("SSid");
//分页
U07CommonListVO cl_vo = new U07CommonListVO();
int start = 0;
boolean isEq = false;
if (StringUtils.isNotEmpty(request.getParameter("start"))) {
start = Integer.parseInt(request.getParameter("start"));
}
if (StringUtils.isNotEmpty(request.getParameter("isEq"))) {
isEq = true;
}
cl_vo = u05bo.serach(SSid , start, isEq);
List list = cl_vo.getRs();
Iterator it = list.iterator();
while(it.hasNext()){
TQuestion tQuestion = (TQuestion)it.next();
String name = tQuestion.getTqName();
if(name.length()>11){
name = name.substring(0,10);
tQuestion.setTqName(name);
}
}
request.getSession().setAttribute("fenye1",cl_vo);
return mapping.findForward("success");
}
public ActionForward searchAll(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
U05BO u05bo = new U05BO();
U05A201Form u05form = (U05A201Form)form;
Integer SSid = (Integer) request.getSession().getAttribute("SSid");
Integer tqtId = new Integer(u05form.getType());
String tqtId1 = u05form.getType();
request.getSession().setAttribute("U05TypeId",tqtId1);
//分页
U07CommonListVO cl_vo = new U07CommonListVO();
int start = 0;
boolean isEq = false;
if (StringUtils.isNotEmpty(request.getParameter("start"))) {
start = Integer.parseInt(request.getParameter("start"));
}
if (StringUtils.isNotEmpty(request.getParameter("isEq"))) {
isEq = true;
}
cl_vo = u05bo.serach(SSid , tqtId , start, isEq);
List list = cl_vo.getRs();
Iterator it = list.iterator();
while(it.hasNext()){
TQuestion tQuestion = (TQuestion)it.next();
String name = tQuestion.getTqName();
if(name.length()>11){
name = name.substring(0,10);
tQuestion.setTqName(name);
}
}
request.getSession().setAttribute("fenye1",cl_vo);
return mapping.findForward("success");
}
public ActionForward update(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
U05BO u05bo = new U05BO();
TTestDAO tTestDAO = new TTestDAO();
String []a = request.getParameterValues("aaa");
int id = u05bo.searchTest(a);
Vector v = tTestDAO.searchNotInTest(a);
Integer SSid = (Integer) request.getSession().getAttribute("SSid");
U05A201Form u05 = (U05A201Form)form;
if(a!=null && a.length>0){
if(id>0){
String aa = "删除失败!题号为:";
for(int j=0;j<v.size();j++){
aa=aa+","+v.get(j);
}
aa+=" 的考题在试卷中以有,无法删除!";
String aaa = aa.replaceFirst(",","");
u05.setAa(aaa);
u05.setI(1);
return mapping.findForward("delete1");
}else{
u05bo.delete(a);
//分页
U07CommonListVO cl_vo = new U07CommonListVO();
int start = 0;
boolean isEq = false;
if (StringUtils.isNotEmpty(request.getParameter("start"))) {
start = Integer.parseInt(request.getParameter("start"));
}
if (StringUtils.isNotEmpty(request.getParameter("isEq"))) {
isEq = true;
}
cl_vo = u05bo.serach(SSid , start, isEq);
List list = cl_vo.getRs();
Iterator it = list.iterator();
while(it.hasNext()){
TQuestion tQuestion = (TQuestion)it.next();
String name = tQuestion.getTqName();
if(name.length()>11){
name = name.substring(0,10);
tQuestion.setTqName(name);
}
}
request.getSession().setAttribute("fenye1",cl_vo);
return mapping.findForward("success");
}
}
return mapping.findForward("success");
}
public ActionForward updateAll(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
U05BO u05bo = new U05BO();
U05A201Form u05form = (U05A201Form)form;
TTestDAO tTestDAO = new TTestDAO();
Integer SSid = (Integer) request.getSession().getAttribute("SSid");
Integer tqtId = new Integer(u05form.getType());
String []a = request.getParameterValues("aaa");
int id = u05bo.searchTest(a);
Vector v = tTestDAO.searchNotInTest(a);
if(a!=null && a.length>0){
if(id>0){
String aa = "删除失败!题号为:";
for(int j=0;j<v.size();j++){
aa=aa+","+v.get(j);
}
aa+=" 的考题在试卷中以有,无法删除!";
String aaa = aa.replaceFirst(",","");
u05form.setAa(aaa);
u05form.setI(1);
return mapping.findForward("delete1");
}else{
u05bo.delete(a);
//分页
U07CommonListVO cl_vo = new U07CommonListVO();
int start = 0;
boolean isEq = false;
if (StringUtils.isNotEmpty(request.getParameter("start"))) {
start = Integer.parseInt(request.getParameter("start"));
}
if (StringUtils.isNotEmpty(request.getParameter("isEq"))) {
isEq = true;
}
cl_vo = u05bo.serach(SSid , tqtId , start, isEq);
List list = cl_vo.getRs();
Iterator it = list.iterator();
while(it.hasNext()){
TQuestion tQuestion = (TQuestion)it.next();
String name = tQuestion.getTqName();
if(name.length()>11){
name = name.substring(0,10);
tQuestion.setTqName(name);
}
}
request.getSession().setAttribute("fenye1",cl_vo);
return mapping.findForward("success");
}
}
return mapping.findForward("success");
}
public ActionForward back(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("back");
}
public ActionForward returnSearch(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
U05BO u05bo = new U05BO();
U05A201Form u05form = (U05A201Form)form;
Integer SSid = (Integer) request.getSession().getAttribute("SSid");
Integer tqtId =new Integer((String)request.getSession().getAttribute("U05TypeId"));
String aaa = (String)request.getSession().getAttribute("U05TypeId");
u05form.setType(aaa);
//分页
U07CommonListVO cl_vo = new U07CommonListVO();
int start = 0;
boolean isEq = false;
if (StringUtils.isNotEmpty(request.getParameter("start"))) {
start = Integer.parseInt(request.getParameter("start"));
}
if (StringUtils.isNotEmpty(request.getParameter("isEq"))) {
isEq = true;
}
cl_vo = u05bo.serach(SSid , tqtId , start, isEq);
List list = cl_vo.getRs();
Iterator it = list.iterator();
while(it.hasNext()){
TQuestion tQuestion = (TQuestion)it.next();
String name = tQuestion.getTqName();
if(name.length()>11){
name = name.substring(0,10);
tQuestion.setTqName(name);
}
}
request.getSession().setAttribute("fenye1",cl_vo);
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -