📄 adtittleaction.java
字号:
/*
* 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 allDAOFactory.ITeacherDAO;
import allBeans.Tittles;
import allDAOFactory.ITittleDAO;
import com.yourcompany.struts.form.AdtittleForm;
/**
* MyEclipse Struts
* Creation date: 07-22-2008
*
* XDoclet definition:
* @struts.action path="/adtittle" name="adtittleForm" input="/Administrators/adtittle.jsp" scope="request" validate="true"
*/
public class AdtittleAction 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) {
AdtittleForm adtittleForm = (AdtittleForm) form;// TODO Auto-generated method stub
String ti_name=adtittleForm.getTi_name();
String ti_thid=adtittleForm.getTi_thid();
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;
}
teacher=thdao.thget(ti_thid);
if(teacher==null)
{
errors.add("adtittlenotthid",new ActionMessage("adteacher.notthid.wrong"));
b_error=true;
}
if(!b_error)
{
tittle=new Tittles();
tittle.setTiName(ti_name);
tittle.setTiThid(ti_thid);
tittle.setTiStsum(0);
tidao.tisave(tittle);
adtittleForm.setTi_name("");
adtittleForm.setTi_thid("");
}
else
this.saveErrors(request, errors);
List list=tidao.tiget();
request.setAttribute("tilist", list);
return mapping.findForward("toadtittle");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -