adgotoaction.java

来自「这是一个可以让学生选择自己喜欢的课题」· Java 代码 · 共 161 行

JAVA
161
字号
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.yourcompany.struts.action;

import java.util.ArrayList;
import java.util.Iterator;
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.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import allBeans.LstBean;
import allBeans.FstBean;
import allBeans.TmConBean;
import allDAOFactory.IAdministratorDAO;
import allDAOFactory.ILastStudentTittleDAO;
import allDAOFactory.IFirstStudentTittleDAO;
import allDAOFactory.IStudentDAO;
import allDAOFactory.ITaskDAO;
import allDAOFactory.ITeacherDAO;
import allDAOFactory.ITittleDAO;
import allDAOFactory.ITimecontrolDAO;
import allBeans.Timecontrol;
/** 
 * MyEclipse Struts
 * Creation date: 07-22-2008
 * 
 * XDoclet definition:
 * @struts.action validate="true"
 */
public class AdgotoAction 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) {
		// TODO Auto-generated method stub
		String loginkey=request.getParameter("loginkey");
		if(loginkey.equals("student"))
		{
			IStudentDAO stdao=new IStudentDAO();
			List list=stdao.stget();
			request.setAttribute("stlist", list);
			return mapping.findForward("toadstudent");
		}
		else if(loginkey.equals("teacher"))
		{
			ITeacherDAO thdao=new ITeacherDAO();
			List list=thdao.thget();
			request.setAttribute("thlist", list);
			return mapping.findForward("toadteacher");
		}
		else if(loginkey.equals("tittle"))
		{
			ITittleDAO tidao=new ITittleDAO();
			List list=tidao.tiget();
			request.setAttribute("tilist", list);
			return mapping.findForward("toadtittle");
		}
		else if(loginkey.equals("admin"))
		{
			IAdministratorDAO addao=new IAdministratorDAO();
			List list=addao.adget();
			request.setAttribute("adlist", list);
			return mapping.findForward("toadadmin");
		}
		else if(loginkey.equals("task"))
		{
			ITaskDAO tadao=new ITaskDAO();
			List list=tadao.taget();
			request.setAttribute("talist", list);
			return mapping.findForward("toadtask");
		}
		else if(loginkey.equals("timecontrol"))
		{
			ITimecontrolDAO tmcondao=new ITimecontrolDAO();
			String sttm=String.valueOf(tmcondao.tmcongetst());
			String thtm=String.valueOf(tmcondao.tmcongetth());
			request.setAttribute("sttm", sttm);
			request.setAttribute("thtm", thtm);
			return mapping.findForward("toadsystem");
		}
		else if(loginkey.equals("fst"))
		{
			IFirstStudentTittleDAO fstdao=new IFirstStudentTittleDAO();
			List list=fstdao.fstget();
			List lastlist=new ArrayList();
			FstBean temp=null;
			Iterator it=list.iterator();
			while(it.hasNext())
			{
				temp=new FstBean();
				Object[] result=(Object[])it.next();
				temp.setFiid(result[0].toString());
				temp.setStid(result[1].toString());
				temp.setStname(result[2].toString());
				temp.setTiid(result[3].toString());
				temp.setTiname(result[4].toString());
				lastlist.add(temp);
				
			}
			request.setAttribute("fstlist", lastlist);
			return mapping.findForward("toadfirstresult");
		}
		else if(loginkey.equals("lst"))
		{
			ILastStudentTittleDAO lstdao=new ILastStudentTittleDAO();
			List list=lstdao.lstget();
			List lastlist=new ArrayList();
			LstBean temp=null;
			Iterator it=list.iterator();
			while(it.hasNext())
			{
				temp=new LstBean();
				Object[] result=(Object[])it.next();
				temp.setStid(result[0].toString());
				temp.setStname(result[1].toString());
				temp.setTiid(result[2].toString());
				temp.setTiname(result[3].toString());
				lastlist.add(temp);
				
			}
			request.setAttribute("lstlist", lastlist);
			return mapping.findForward("toadlastresult");
		}
		else if(loginkey.equals("changepsw"))
		{
			return mapping.findForward("toadchangepassword");
		}
		else if(loginkey.equals("help"))
		{
			return mapping.findForward("toadhelp");
		}
		else if(loginkey.equals("out"))
		{
			request.getSession().removeAttribute("userID");
			request.getSession().removeAttribute("ad_name");
			return mapping.findForward("tologinad");
		}
		else
		{
			return mapping.getInputForward();
		}
	}
}

⌨️ 快捷键说明

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