📄 u04a100action.java
字号:
package cn.hope.front.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
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.action.ActionMessages;
import org.apache.struts.actions.DispatchAction;
import org.apache.struts.validator.DynaValidatorForm;
import cn.hope.front.bo.U04A100BO;
import cn.hope.front.bo.U04A11BO;
import cn.hope.front.form.validation.U04A100FormVaild;
import cn.hope.front.pojo.CSubject;
import cn.hope.front.pojo.TQtype;
import cn.hope.front.pojo.TQuestion;
import cn.hope.front.pojo.TTest;
import cn.hope.front.pojo.TTestInfo;
import cn.hope.front.pojo.U07CommonListVO;
public class U04A100Action extends DispatchAction {
public ActionForward find(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
U04A11BO u04A11BO = new U04A11BO();
int start = 0;
boolean isEq = false;
U07CommonListVO cl_vo = new U07CommonListVO();
List list = u04A11BO.aroundsubject();
U04A100BO u04A100BO = new U04A100BO();
List list2 = u04A100BO.searchtqtName();
HttpSession session = request.getSession();
session.setAttribute("info", list);
session.setAttribute("type", list2);
if (StringUtils.isNotEmpty(request.getParameter("start"))) {
start = Integer.parseInt(request.getParameter("start"));
}
if (StringUtils.isNotEmpty(request.getParameter("isEq"))) {
isEq = true;
}
TQuestion tQuestion = new TQuestion();
DynaValidatorForm u04A100Form = (DynaValidatorForm) form;
//u04A100Form.set("cSubject",)
tQuestion = (TQuestion) u04A100Form.get("subject");
cl_vo = u04A100BO.serachQues(tQuestion, start, isEq);
session.setAttribute("con", cl_vo);
return mapping.findForward("a100");
}
public ActionForward sear(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
U07CommonListVO cl_vo = new U07CommonListVO();
HttpSession session=request.getSession();
U04A100BO u04A100BO = new U04A100BO();
TQuestion tQuestion = new TQuestion();
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;
}
DynaValidatorForm u04A100Form = (DynaValidatorForm) form;
CSubject cSubject= (CSubject)u04A100Form.get("cSubject");
tQuestion.setCSubject(cSubject);
TQtype tQtype= (TQtype)u04A100Form.get("tQtype");
tQuestion.setTQtype(tQtype);
cl_vo = u04A100BO.serachQues(tQuestion,start,isEq);
session.setAttribute("con",cl_vo);
return mapping.findForward("a100");
}
public ActionForward add(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String[] ids = request.getParameterValues("edit_checkbox");
U04A100BO u04A100BO = new U04A100BO();
TTest tTest = new TTest();
String point = null;
DynaValidatorForm u04A100Form = (DynaValidatorForm) form;
//String[] point = request.getParameterValues("points");
//String[] tqId=request.getParameterValues("zhtt");
//System.out.println(tqId.length);
ActionMessages errors = new ActionMessages();
errors = U04A100FormVaild.checkErrors(u04A100Form,request);
if (errors.size() != 0) {
saveErrors(request, errors);
return mapping.findForward("a100");
}
if(ids!=null){
for(int i=0;i<ids.length;i++){
point=request.getParameter(ids[i]);
System.out.println("题id:"+ids[i]+" 分数:"+point);
tTest.setFlag("0");
String infoid = (String)request.getParameter("id");
TTestInfo tTestInfo = new TTestInfo();
tTestInfo.setTTestid(new Integer(infoid));
TQuestion tQuestion = new TQuestion();
tQuestion.setTqId(new Integer(ids[i]));
tTest.setTQuestion(tQuestion);
tTest.setTTestInfo(tTestInfo);
tTest.setTQuestionspoint(Integer.parseInt(point));
//tTest.setTTestInfo(new TTestInfo);
if(u04A100BO.looks(infoid,ids[i]).size()==0){
u04A100BO.saves(tTest);
}
}
}
return mapping.findForward("a100");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -