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

📄 u03c14action.java

📁 持久层hibernate技术使用的一个例子
💻 JAVA
字号:
package cn.hope.mana.action;




import java.sql.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;

import cn.hope.mana.bo.U03C14BO;
import cn.hope.mana.pojo.TInfo;

public class U03C14Action extends DispatchAction{
	//查找指定教师信息
	public ActionForward search(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
	    U03C14BO tf = new U03C14BO();
	    DynaActionForm dfm= (DynaActionForm) form;
	    TInfo tinfo=null;
	    String value=request.getParameter("id");
	    if(value!=null){
	    	tinfo=tf.searchKey(value);
	    }
	    if(tinfo!=null){
	      String birth=tinfo.getTBirth().toString();
	      if(birth!=null){
	    	  dfm.set("birth",birth);
	      }
	      Date over=(Date) tinfo.getTOver();
	      String str="";
	      if(over!=null){
	    	  str=over.toString();
	    	  dfm.set("date",str);
	      }
	      else{
	    	  str="";
	    	  dfm.set("date",str);
	      }
	      dfm.set("tinfo",tinfo);
		  return mapping.findForward("success");
		}
		return mapping.findForward("errors");
	}
	//添加数据
	public ActionForward insert(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		 return null;
	}
	//教师表数据更新
	public ActionForward update(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		  U03C14BO tf = new U03C14BO();
		  DynaActionForm dfm= (DynaActionForm) form;
		  TInfo tinfo=(TInfo)dfm.get("tinfo");
		  if(tinfo!=null){
			 tf.update(tinfo);
			 return mapping.findForward("success");
		  }
	      return mapping.findForward("errors");
	}
	
	
	//Email群发 
	public ActionForward sendEmail(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		/*  
		  U03C14BO tf = new U03C14BO();
		  DynaActionForm dfm= (DynaActionForm) form;

		  String[] array=dfm.getStrings("ht");
		*/
		return null;
	}
	
	
	//生成报表的方法 
	public ActionForward make(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		/*  U03C14BO tf = new U03C14BO();
		  DynaActionForm dfm= (DynaActionForm) form;

		  String[] array=dfm.getStrings("ht");
	   */
		return null;
	}

	
	//对教师表进行删除操作方法
	public ActionForward delete(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		  
		  U03C14BO tf = new U03C14BO();
		  DynaActionForm dfm= (DynaActionForm) form;
		  String[] array=dfm.getStrings("ht");
		  if(array!=null && array.length>0){
				for(int i=0,size=array.length;i<size;i++){
					TInfo tinfo=tf.searchKey(array[i]);
					tinfo.setFlag("1");	   
					tf.update(tinfo);
			    }
		    return mapping.findForward("success");
		  }
		return mapping.findForward("errors");
	}
	
	public ActionForward tianjia(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		TInfo tinfo=new TInfo();
		String birth="";
		String date="";
		DynaActionForm dfm=(DynaActionForm)form;
		dfm.set("tinfo",tinfo);
		dfm.set("birth",birth);
		dfm.set("date",date);//默认值
		return mapping.findForward("success");
	}
}

⌨️ 快捷键说明

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