adtittleeditaction.java
来自「这是一个可以让学生选择自己喜欢的课题」· Java 代码 · 共 109 行
JAVA
109 行
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.yourcompany.struts.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import allBeans.Teachers;
import allBeans.Tittles;
import allDAOFactory.ITeacherDAO;
import allDAOFactory.ITittleDAO;
import com.yourcompany.struts.form.AdtittleeditForm;
/**
* MyEclipse Struts
* Creation date: 07-23-2008
*
* XDoclet definition:
* @struts.action path="/adtittleedit" name="adtittleeditForm" input="/Administrators/adtittleedit.jsp" scope="request" validate="true"
*/
public class AdtittleeditAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
AdtittleeditForm adtittleeditForm = (AdtittleeditForm) form;// TODO Auto-generated method stub
Integer ti_id=adtittleeditForm.getTi_id();
String ti_name=adtittleeditForm.getTi_name();
String ti_thid=adtittleeditForm.getTi_thid();
Integer ti_stsum=adtittleeditForm.getTi_sum();
ActionErrors errors=new ActionErrors();
ITeacherDAO thdao=new ITeacherDAO();
Teachers teacher=new Teachers();
ITittleDAO tidao=new ITittleDAO();
Tittles tittle=new Tittles();
boolean b_error=false;
if(ti_name==null || ti_name.equals(""))
{
errors.add("ti_name",new ActionMessage("adteacher.ti_name.wrong"));
b_error=true;
}
if(ti_thid==null || ti_thid.equals(""))
{
errors.add("ti_thid",new ActionMessage("adteacher.ti_thid.wrong"));
b_error=true;
}
if(ti_stsum<0)
{
errors.add("ti_thid",new ActionMessage("adteacher.ti_thid.wrong"));
b_error=true;
}
teacher=thdao.thget(ti_thid);
if(teacher==null)
{
errors.add("adtittlenotthid",new ActionMessage("adteacher.notthid.wrong"));
b_error=true;
}
tittle=tidao.tiget(ti_id);
if(tittle==null)
{
errors.add("adtittlenotthid",new ActionMessage("adteacher.notthid.wrong"));
b_error=true;
}
if(!b_error)
{
tittle.setTiName(ti_name);
tittle.setTiThid(ti_thid);
tittle.setTiStsum(ti_stsum);
tidao.tiupdate(tittle);
List list=tidao.tiget();
request.setAttribute("tilist", list);
return mapping.findForward("toadtittle");
}
else
{
this.saveErrors(request, errors);
request.setAttribute("ti_id", ti_id);
return mapping.getInputForward();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?