createallergyhistory.java
来自「是一个J2EE的项目,在eclipse下编译通过,应用struts,hibern」· Java 代码 · 共 49 行
JAVA
49 行
package com.bjjd.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.bjjd.datamodel.Allergyhistory;
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.bjjd.DAO.AllergyhistoryDAO;
/*
* 新建过敏史记录动作
*
*/
public class Createallergyhistory extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
try
{
//创建过敏史实体对象
Allergyhistory ah=new Allergyhistory();
ah.setName(request.getParameter("name"));
ah.setSex(request.getParameter("sex"));
ah.setType(request.getParameter("type"));
ah.setDescription(request.getParameter("description"));
//调用DAO方法新建记录
AllergyhistoryDAO m=new AllergyhistoryDAO();
m.createallergyhistory(ah);
//保存信息
request.setAttribute("fds", "success");
}
catch(Exception e)
{
request.setAttribute("error", e.toString()+"bbbb");
return (mapping.findForward("failed"));
}
return (mapping.findForward("success"));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?