📄 modifybuyproductaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package cn.bway.foreigntrade.repertory.buyproduct.action;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.Session;
import org.hibernate.Transaction;
import cn.bway.common.WebConstant;
import cn.bway.common.action.BaseAction;
import cn.bway.common.dao.HibernateSessionFactory;
import cn.bway.foreigntrade.repertory.buyproduct.form.BuyproductForm;
import cn.bway.foreigntrade.repertory.buyproduct.impl.BuyproductManagerFactory;
import cn.bway.foreigntrade.repertory.buyproduct.model.Buyproduct;
/**
* MyEclipse Struts
* Creation date: 03-12-2008
*
* XDoclet definition:
* @struts.action path="/modify" name="buyproductForm" scope="request" validate="true"
*/
public class ModifyBuyproductAction extends BaseAction {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
BuyproductForm eForm=(BuyproductForm) form;
ActionErrors errors = new ActionErrors();
Session sess = null;
Transaction tx = null;
String returnStr = null;
Connection conn = null;
//瀵版鍩孭ersonal閸氬嫬鐡у▓闈涳拷锟?
try {
request.setCharacterEncoding("utf-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
String act=request.getParameter("act");
String id = request.getParameter("id");
System.out.println("----------------------------------------"+id);
try {//閺囧瓨鏌奝ersonal鐞涳拷
if("modify".equals(act)){//閺屻儳婀呴幙宥勭稊
Buyproduct per=(Buyproduct) BuyproductManagerFactory.getBuyproductManager().getBuyproduct(id);
request.setAttribute("ModilfyBuyproduct", per);
returnStr ="view";
}else{
Buyproduct exp=(Buyproduct) BuyproductManagerFactory.getBuyproductManager().getBuyproduct(request.getParameter("id"));
exp.setBuydocumentid(eForm.getBuydocumentid());
exp.setSpecs(eForm.getSpecs());
exp.setColors(eForm.getColors());
exp.setTotals(eForm.getTotals());
exp.setTotalprice(eForm.getTotalprice());
exp.setNotes(eForm.getNotes());
exp.setSimpleprice(eForm.getSimpleprice());
exp.setPicurl(eForm.getPicurl());
exp.setProductid(eForm.getProductid());
BuyproductManagerFactory.getBuyproductManager().modfilyBuyproduct(exp);
returnStr=WebConstant.FORWARD_INITPAGE;
}
} catch (Exception e) {//瀵倸鐖舵径鍕倞閿涘苯鍙忕仦锟芥潪顒佸床閼风牣rror.jsp
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("edu.system.excption", e.getMessage()));
this.saveErrors(request, errors);
tx.rollback();
e.printStackTrace();
} finally {
try {
if (null != conn) {
conn.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
HibernateSessionFactory.closeSession();
}
return mapping.findForward(returnStr);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -