/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.aptech.jb.epet.web.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
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.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.actions.DispatchAction;
import com.aptech.jb.epet.biz.PetInfoBiz;
import com.aptech.jb.epet.biz.impl.PetInfoBizImpl;
import com.aptech.jb.epet.entity.PetInfo;
import com.aptech.jb.epet.web.form.PetForm;
/**
* MyEclipse Struts Creation date: 02-14-2011
*
* XDoclet definition:
*
* @struts.action validate="true"
*/
public class PetAction extends DispatchAction {
/*
* Generated Methods
*/
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws IOException
*/
public ActionForward doLogin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
PetForm petForm = (PetForm) form;
String petId = String.valueOf(petForm.getItem().getPetId());
String petPassword = petForm.getItem().getPetPassword();
String vcode = request.getParameter("item.petVcode");
PetInfoBiz biz = new PetInfoBizImpl();
PetInfo petInfo = biz.login(petId, petPassword);
if (!vcode.equals(request.getSession().getAttribute("vcode"))) {
ActionMessages errors = new ActionMessages();
errors.add("login", new ActionMessage("error.login.wrong_vcode"));
super.saveErrors(request, errors);
return mapping.findForward("fail");
}
if (petInfo != null) {
request.getSession(true).setAttribute("CURRENT_PET", petInfo);
// this.showBaby(mapping, dynaForm, request, response);
response.sendRedirect("pet.do?id=" + petId+"&operate=showBaby");
return null;
} else {
ActionMessages errors = new ActionMessages();
errors.add("login",
new ActionMessage("error.login.wrong_id_or_pwd"));
super.saveErrors(request, errors);
return mapping.findForward("fail");
}
}
public ActionForward doFeed(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
String petId = request.getParameter("petId");
PetInfoBiz biz = new PetInfoBizImpl();
biz.doFeed(Integer.parseInt(petId));
response.sendRedirect("pet.do?id=" + petId+"&operate=showBaby");
return null;
}
public ActionForward doGame(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
String petId = request.getParameter("petId");
PetInfoBiz biz = new PetInfoBizImpl();
biz.doGame(Integer.parseInt(petId));
response.sendRedirect("pet.do?id=" + petId+"&operate=showBaby");
return null;
}
public ActionForward doStory(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
String petId = request.getParameter("petId");
PetInfoBiz biz = new PetInfoBizImpl();
biz.doStory(Integer.parseInt(petId));
response.sendRedirect("pet.do?id=" + petId+"&operate=showBaby");
return null;
}
public ActionForward showBaby(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//PetDiaryBiz pdb=new PetDiaryBizImpl();
String id =request.getParameter("id");
String error = "";
if (null == id || "".equals(id)) {
request.setAttribute("error", "没有指定宠物编号");
return mapping.findForward("error");
}
Integer petId = Integer.valueOf(id);
//List diaryList=pdb.getListByPet(petId);
PetInfoBiz biz = new PetInfoBizImpl();
PetInfo petInfo = biz.load(petId);
if (null == petInfo) {
request.setAttribute("error", "没有指定编号的宠物记录");
return mapping.findForward("error");
}
request.setAttribute("item", petInfo);
//request.setAttribute("diaryList", diaryList);
return mapping.findForward("petInfo");
}
public ActionForward toEditPet(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String id = request.getParameter("petId");
String error = "";
if (null == id || "".equals(id)) {
request.setAttribute("error", "没有指定宠物编号");
return mapping.findForward("error");
}
Integer petId = Integer.valueOf(id);
PetInfoBiz biz = new PetInfoBizImpl();
PetInfo petInfo = biz.load(petId);
if (null == petInfo) {
request.setAttribute("error", "没有指定编号的宠物记录");
return mapping.findForward("error");
}
request.setAttribute("item", petInfo);
return mapping.findForward("update");
}
public ActionForward doEditPet(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
PetForm petForm = (PetForm) form;
String name = petForm.getItem().getPetName();
String email = petForm.getItem().getPetOwnerEmail();
String intro = petForm.getItem().getPetIntro();
int petId = Integer.parseInt(request.getParameter("id"));
PetInfoBiz pib = new PetInfoBizImpl();
PetInfo pet = pib.load(Integer.valueOf(petId));
pet.setPetId(Integer.valueOf(petId));
pet.setPetName(name);
pet.setPetOwnerEmail(email);
pet.setPetIntro(intro);
int num = pib.updatePet(pet);
if (num > 0) {
// request.getRequestDispatcher("jsp/pet/petInfo.jsp").forward(request,
// response);
response.sendRedirect("pet.do?id=" + petId+"&operate=showBaby");
} else {
request.setAttribute("error", "更新失败");
return mapping.findForward("error");
}
return null;
}
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
PetInfoBiz pib=new PetInfoBizImpl();
PetForm petForm=(PetForm) form;
List list=pib.search(petForm.getCondition(), petForm.getOrderBy());
if(list!=null &&list.size()>0){
request.setAttribute("list", list);
return mapping.findForward("list");
}else{
request.setAttribute("error", "没有宠物记录");
return mapping.findForward("error");
}
}
public ActionForward doAdopt(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
PetForm petForm = (PetForm) form;// TODO Auto-generated method stub
if(petForm.getItem().getPetName()==null){
return mapping.findForward("adopt");
}
PetInfo item=petForm.getItem();
PetInfoBiz pib=new PetInfoBizImpl();
pib.adopt(item);
try {
response.setContentType("text/html;charset=GBK");
PrintWriter out = response.getWriter();
out.print("<script>alert('宠物ID:"+item.getPetId()+"');location.href='pet.do?id="+item.getPetId()+"&operate=showBaby'</script>");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public ActionForward doDel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
int petId = Integer.parseInt(request.getParameter("id"));
PetInfoBiz pib = new PetInfoBizImpl();
int num = pib.del(petId);
if (num > 0) {
// request.getSession().setAttribute("CURRENT_PET",null);
response.sendRedirect("jsp/pet/index.jsp");
} else {
request.setAttribute("error", "删除失败");
return mapping.findForward("error");
}
return null;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架
共121个文件
jar:31个
class:17个
java:17个
2星 需积分: 9 33 下载量 97 浏览量
2011-07-20
19:34:02
上传
评论 1
收藏 9.8MB RAR 举报
温馨提示
ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架
资源推荐
资源详情
资源评论
收起资源包目录
ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 (121个子文件)
PetAction.class 7KB
PetInfoDAOHibImpl.class 4KB
PetInfo.class 4KB
PetDiary.class 4KB
DiaryAction.class 3KB
BaseHibernateDAO.class 3KB
HibernateSessionFactory.class 2KB
PetDiaryDAOHibImpl.class 2KB
PetInfoBizImpl.class 2KB
PetDiaryBizImpl.class 2KB
PetForm.class 1KB
MyFilter.class 1KB
DiaryForm.class 847B
PetInfoDao.class 633B
PetInfoBiz.class 618B
PetDiaryDao.class 346B
PetDiaryBiz.class 327B
.classpath 3KB
org.eclipse.wst.jsdt.ui.superType.container 49B
Thumbs.db 60KB
hibernate3.jar 1.88MB
jgroups-2.2.8.jar 1.54MB
xerces-2.6.2.jar 987KB
jboss-jmx.jar 578KB
jboss-common.jar 570KB
c3p0-0.9.0.jar 476KB
proxool-0.8.3.jar 465KB
antlr-2.7.6rc1.jar 434KB
sqljdbc4.jar 413KB
standard.jar 384KB
jboss-cache.jar 366KB
log4j-1.2.11.jar 342KB
dom4j-1.6.1.jar 307KB
cglib-2.1.3.jar 276KB
jaxen-1.1-beta-7.jar 222KB
jboss-system.jar 218KB
commons-collections-2.1.1.jar 171KB
concurrent-1.3.2.jar 167KB
xml-apis.jar 121KB
oscache-2.1.jar 112KB
jaas.jar 102KB
ehcache-1.1.jar 46KB
commons-logging-1.0.4.jar 37KB
swarmcache-1.0rc2.jar 30KB
asm.jar 26KB
jacc-1_0-fr.jar 24KB
jstl.jar 20KB
connector.jar 18KB
asm-attrs.jar 16KB
jta.jar 9KB
jdbc2_0-stdext.jar 7KB
PetAction.java 8KB
PetInfoDAOHibImpl.java 3KB
PetInfo.java 3KB
PetDiary.java 3KB
HibernateSessionFactory.java 3KB
DiaryAction.java 3KB
BaseHibernateDAO.java 2KB
PetForm.java 1KB
PetInfoBizImpl.java 1KB
PetDiaryDAOHibImpl.java 971B
PetDiaryBizImpl.java 909B
DiaryForm.java 848B
MyFilter.java 776B
PetInfoDao.java 658B
PetInfoBiz.java 626B
PetDiaryDao.java 531B
PetDiaryBiz.java 280B
dragon_game.jpg 77KB
cat_story.jpg 55KB
dragon_feed.jpg 52KB
cat.jpg 45KB
unkown.jpg 36KB
cat_feed.jpg 27KB
cat_game.jpg 21KB
dragon_story.jpg 17KB
dragon.jpg 8KB
pig_feed.jpg 5KB
pig.jpg 5KB
pig_story.jpg 4KB
pig_game.jpg 4KB
.jsdtscope 500B
index.jsp 13KB
adopt.jsp 5KB
petInfo.jsp 4KB
diary.jsp 3KB
list.jsp 2KB
vcode.jsp 2KB
update.jsp 2KB
listPet.jsp 2KB
detail.jsp 1KB
error.jsp 854B
epet_Log.LDF 1024KB
epet_Data.MDF 3MB
.struts-config.mex 4KB
MANIFEST.MF 39B
.myhibernatedata 555B
.mymetadata 285B
.mystrutsdata 257B
.myumldata 66B
共 121 条
- 1
- 2
资源评论
- imufengxianyong2012-06-24不是很完整
- cc陈(Skylar)2012-06-18啥,数据库导入不行,只用到2个框架,重要的sprig不见
chenglinjava
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 西门子V90效率倍增-伺服驱动功能库详解-简易非循环功能库之绝对值编码器校准.mp4
- 六轴,scara机器人运动学分析,建模和运动控制 matlab,simulink,simscape.机器人工具箱,DH建模 Pd控制,滑模控制,模糊控制等等
- 车辆,汽车检测1-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 美国旧金山28R粗糙跑道数据
- mp3转换器小程序-音频20241222115740.mp3
- 车辆船只检测8-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- Questasim仿真脚本2
- Questasim仿真脚本
- Django开发中常见问题与解决方案的全面指南
- 西工大noj 116题及答案word版.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功