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

📄 u05tinofaction.java

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



import java.util.HashMap;
import java.util.Map;

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

import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.LookupDispatchAction;

import cn.hope.front.bo.U05TInfoBO;

import cn.hope.front.pojo.TInfo;

public class U05TInofAction extends LookupDispatchAction {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		HttpSession session=request.getSession();
		//U05TInfoForm tform =(U05TInfoForm)form;
		//System.out.println(tform.getTBirth());
		try{
			TInfo tInfo = new TInfo();
			U05TInfoBO u05TInfoBO = new U05TInfoBO();
			tInfo = u05TInfoBO.find("wudibo");
			
			if(StringUtils.isEmpty(request.getParameter("asd")))
			{
				if(tInfo.getTSex().equals("0")){
					tInfo.setTSex("男");
				}
				else{
					tInfo.setTSex("女");
				}
				if(tInfo.getTMarry().equals("0")){
					tInfo.setTMarry("已");
				}
				else{
					tInfo.setTMarry("未");
				}
				session.setAttribute("tInfoList",tInfo);
				return mapping.findForward("U05TInfo");
			}
			else
			{
				request.setAttribute("tform",form);
				session.setAttribute("tInfoList",tInfo);
				return mapping.findForward("c00");
			}
		} 
		catch (Exception e) {
			e.printStackTrace();
		}
		return mapping.findForward("error");
	}
	
	public ActionForward retrun(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		return mapping.findForward("U05TInfo");
	}
	
	protected Map getKeyMethodMap() {
		HashMap hm = new HashMap();
		hm.put("tInfo.jsp.executeButton.name","execute");
		hm.put("tInfo.jsp.retrunButton.name","return");
		return hm;
	}

}

⌨️ 快捷键说明

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