📄 u04a11action.java
字号:
package cn.hope.front.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
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.U04TTestInfoBO;
import cn.hope.front.form.validation.U04A11FormVaild;
import cn.hope.front.pojo.CSubject;
import cn.hope.front.pojo.TInfo;
import cn.hope.front.pojo.TTestInfo;
import cn.hope.front.util.Utility;
public class U04A11Action extends DispatchAction {
public ActionForward find(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try{
String id = request.getParameter("id");
TTestInfo tTestInfo = new TTestInfo();
HttpSession session=request.getSession();
System.out.println(id+"#$$$$$$$$$$$$$$$$$$$$$$$");
//判断进入页面的id
if(!id.equals("999999")){
U04TTestInfoBO u04TTestInfoBO = new U04TTestInfoBO();
tTestInfo = u04TTestInfoBO.info(id);
String date = tTestInfo.getTTestdate().toString();
//控制日期格式
date = date.substring(0,10);
tTestInfo.setTTestdate(Utility.stringToDate(date));
session.setAttribute("info",tTestInfo);
}
else{
session.setAttribute("info",tTestInfo);
}
}
catch(Exception e)
{
e.printStackTrace();
}
return mapping.findForward("a11");
}
public ActionForward go(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionMessages errors = new ActionMessages();
U04TTestInfoBO u04TTestInfoBO = new U04TTestInfoBO();
DynaValidatorForm u04A11Form = (DynaValidatorForm) form;
TTestInfo tTestInfo = new TTestInfo();
CSubject cSubject = new CSubject();
TInfo tInfo = new TInfo();
try{
tTestInfo = (TTestInfo)u04A11Form.get("testInfovalue");
cSubject = (CSubject)u04A11Form.get("subjectInfovalue");
String date = (String)u04A11Form.get("date1");
errors = U04A11FormVaild.checkErrors(u04A11Form,request);
if (errors.size() != 0) {
saveErrors(request, errors);
return mapping.findForward("a11");
}
String id = request.getParameter("id");
//修改
if(!id.equals("999999")){
tTestInfo.setFlag("0");
tTestInfo.setTTestid(new Integer(id));
tTestInfo.setCSubject(cSubject);
tInfo.setTId("aa");
tTestInfo.setTInfo(tInfo);
tTestInfo.setTTestdate(Utility.stringToDate(date));
u04TTestInfoBO.updates(tTestInfo);
}
//插入
else{
tTestInfo.setFlag("0");
tTestInfo.setCSubject(cSubject);
//System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
tInfo.setTId("aa");
tTestInfo.setTInfo(tInfo);
tTestInfo.setTTestdate(Utility.stringToDate(date));
u04TTestInfoBO.saves(tTestInfo);
}
}
catch(Exception e){
e.printStackTrace();
}
return mapping.findForward("a11000");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -