⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 theditinfoaction.java

📁 这是一个可以让学生选择自己喜欢的课题
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.yourcompany.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.yourcompany.struts.form.TheditinfoForm;

import allBeans.Teachers;
import allDAOFactory.ITeacherDAO;
/** 
 * MyEclipse Struts
 * Creation date: 08-04-2008
 * 
 * XDoclet definition:
 * @struts.action path="/theditinfo" name="theditinfoForm" input="/Teachers/theditinfo.jsp" scope="request" validate="true"
 */
public class TheditinfoAction 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) {
		TheditinfoForm theditinfoForm = (TheditinfoForm) form;// TODO Auto-generated method stub

		String thid=(String)request.getSession().getAttribute("userID");
		if(thid==null)
			return mapping.findForward("tologinth");
		if(this.isCancelled(request))
		{
			ITeacherDAO thdao=new ITeacherDAO();
			Teachers teacher=thdao.thget(thid);
			request.setAttribute("teacher", teacher);
			return mapping.findForward("tothselfinfo");
		}
		
		String thsex=theditinfoForm.getTh_sex();
		String thpro=theditinfoForm.getTh_profession();
		String thstudy=theditinfoForm.getTh_study();
		String themail=theditinfoForm.getTh_email();
		String thphone=theditinfoForm.getTh_th_phone();
		String thmemo=theditinfoForm.getTh_memo();
		if(thsex==null||thpro==null)
		{
			ITeacherDAO thdao=new ITeacherDAO();
			Teachers th=thdao.thget(thid);
			request.setAttribute("thname", th.getThName());
		    request.setAttribute("thid", th.getThId());
			return mapping.getInputForward();
		}
		ITeacherDAO thdao=new ITeacherDAO();
		Teachers th=thdao.thget(thid);
		if(th!=null)
		{
			th.setThEmail(themail);
			th.setThMemo(thmemo);
			th.setThPhone(thphone);
			th.setThProfession(thpro);
			th.setThSex(thsex);
			th.setThStudy(thstudy);
			thdao.thupdate(th);
			request.setAttribute("teacher", th);
			return mapping.findForward("tothselfinfo");
		}
		return null;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -