📄 grtxl_updateaction.java
字号:
package com.wondersgroup.txl.web.Action;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
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.wondersgroup.framework.core.bo.Page;
import com.wondersgroup.txl.bo.GrTxlBo;
import com.wondersgroup.txl.service.GrTxlService;
import com.wondersgroup.txl.web.Form.GrTxlForm;
public class GrTxl_UpdateAction extends Action {
private GrTxlService grTxlService;
public void setGrTxlService(GrTxlService grTxlService) {
this.grTxlService = grTxlService;
}
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws ParseException{
String id = httpServletRequest.getParameter("id");//信息id;
String flag = httpServletRequest.getParameter("flag");
ActionForward forward = actionMapping.findForward("list");//跳转到list页面;
GrTxlForm add = (GrTxlForm) actionForm;
GrTxlBo grTxlbo = new GrTxlBo();
if(flag!=null&&flag.equals("update"))//进入修改页面;
{
List list = grTxlService.getContractGRInfo(id);//根据id,查询信息;
httpServletRequest.setAttribute("Grview", list);
forward = actionMapping.findForward("update");//进入修改页面;
}else{//修改信息后,提交页面;
Date date = null;
SimpleDateFormat fordate = new SimpleDateFormat("yyyy-MM-dd");
date = fordate.parse(add.getSr()); //将String转换为date;
grTxlbo.setId(Long.parseLong(id));
grTxlbo.setBm(add.getBm());
grTxlbo.setDw(add.getDw());
grTxlbo.setDwcz(add.getDwcz());
grTxlbo.setDwdh(add.getDwdh());
grTxlbo.setDwdz(add.getDwdz());
grTxlbo.setDwyb(add.getDwyb());
grTxlbo.setEmail(add.getEmail());
grTxlbo.setJtdh(add.getJtdh());
grTxlbo.setJtdz(add.getJtdz());
grTxlbo.setJtyb(add.getJtyb());
grTxlbo.setPy(add.getPy());
grTxlbo.setQtdh(add.getQtdh());
grTxlbo.setSj(add.getSj());
grTxlbo.setSr(date);
grTxlbo.setUserid(add.getUserid());
grTxlbo.setXm(add.getXm());
grTxlbo.setZw(add.getZw());
grTxlService.editContractGRInfo(grTxlbo);//进行修改操作;
Page page = grTxlService.getContractsGRList(add.getUserid(), "", "", "",1,3);// 根据用户id查出,用户的所有个人通讯录记录;
httpServletRequest.setAttribute("page", page);
}
return forward;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -