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

📄 steditaction.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.SteditForm;

import allBeans.FirstStudentTittle;
import allBeans.LastStudentTittle;
import allBeans.StZhiyuan;
import allDAOFactory.IFirstStudentTittleDAO;
import allDAOFactory.ILastStudentTittleDAO;
import allDAOFactory.ITittleDAO;
/** 
 * MyEclipse Struts
 * Creation date: 07-30-2008
 * 
 * XDoclet definition:
 * @struts.action path="/stedit" name="steditForm" input="/Students/stedit.jsp" scope="request" validate="true"
 */
public class SteditAction 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) {
		SteditForm steditForm = (SteditForm) form;// TODO Auto-generated method stub
		
		String stid=(String)request.getSession().getAttribute("userID"); //得到学生的ID
		if(stid==null)
			return mapping.findForward("tologinst");
		
		String fiid=steditForm.getSt_fiid();  //得到要更新纪录的记录号
		String word=steditForm.getSt_word();  //得到更新后的留言
		String tm=(String)request.getSession().getAttribute("tm");
		
		if(tm.equals("1"))
		{
			IFirstStudentTittleDAO fstdao=new IFirstStudentTittleDAO();  //进行保存工作
			FirstStudentTittle fst=fstdao.fstgetbyfiid(Integer.parseInt(fiid));
			if(fst!=null)
			{
			  fst.setFiWord(word);
			  fstdao.fstupdate(fst);
			}
			
			//设置JSP页面的内容参数
		    fstdao=new IFirstStudentTittleDAO();
			StZhiyuan stzhiyuanone=fstdao.fstget(stid,"1");
			StZhiyuan stzhiyuantwo=fstdao.fstget(stid,"2");
			StZhiyuan stzhiyuanthree=fstdao.fstget(stid,"3");
			request.setAttribute("stzhiyuanone", stzhiyuanone);
			request.setAttribute("stzhiyuantwo", stzhiyuantwo);
			request.setAttribute("stzhiyuanthree", stzhiyuanthree);
			return mapping.findForward("tostfirstmain");
		}
		else if(tm.equals("2"))
		{
			ILastStudentTittleDAO lstdao=new ILastStudentTittleDAO();
			LastStudentTittle lst=lstdao.lstget(stid);
			if(lst!=null)
			{
				lst.setLaWord(word);
				lstdao.lstupdate(lst);
			}
			
//			设置JSP页面的内容参数
		    lstdao=new ILastStudentTittleDAO();
			StZhiyuan stzhiyuan=lstdao.lstgetzhiyuan(stid);
			request.setAttribute("stzhiyuan", stzhiyuan);
			if(stzhiyuan==null)
			{
				request.setAttribute("prior", "4");
			}
			else
			{
				ITittleDAO tidao=new ITittleDAO();
				String timemo=tidao.tiget(stzhiyuan.getTiid()).getTiMemo();
				request.setAttribute("timemo", timemo);
				request.setAttribute("prior", stzhiyuan.getPrior());
			}
			return mapping.findForward("tostsecondmain");			
		}
		else
		{
			request.removeAttribute("userID");
			request.removeAttribute("st_name");
			request.removeAttribute("tm");
			return mapping.findForward("tologinst");
		}
	}
}

⌨️ 快捷键说明

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