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

📄 loginthaction.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.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 allDAOFactory.ITimecontrolDAO;
import com.yourcompany.struts.form.LoginthForm;

/** 
 * MyEclipse Struts
 * Creation date: 07-29-2008
 * 
 * XDoclet definition:
 * @struts.action path="/loginth" name="loginthForm" input="/Teachers/loginth.jsp" scope="request" validate="true"
 */
public class LoginthAction 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) {
		LoginthForm loginthForm = (LoginthForm) form;// TODO Auto-generated method stub

		ITeacherDAO thdao=new ITeacherDAO();
		Teachers teacher=new Teachers();	
		teacher=thdao.thget(loginthForm.getUserid());
		if(teacher!=null && teacher.getThPassword().equals(loginthForm.getPassword()))
		{
			String thid=teacher.getThId();
			request.getSession().setAttribute("userID",thid );
			request.getSession().setAttribute("th_name", teacher.getThName());
			ITimecontrolDAO tmdao=new ITimecontrolDAO();
			Integer ntm=tmdao.tmcongetth();
			String tm=String.valueOf(ntm);
			request.getSession().setAttribute("tm", tm);
			return mapping.findForward("toteachermain");
		}
		else
		{
			ActionErrors errors=new ActionErrors();
			if(teacher==null){
				errors.add("userid",new ActionMessage("user is not exist!"));
				this.addErrors(request,errors);
				return mapping.getInputForward();
			}
			if(loginthForm.getPassword().equals(teacher.getThPassword())){
				errors.add("password",new ActionMessage("password is error!"));
				this.addErrors(request, errors);
				return mapping.getInputForward();
			}
			return mapping.getInputForward();
		}
	}
}

⌨️ 快捷键说明

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