📄 billaction.java
字号:
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.1/xslt/JavaClass.xslpackage com.my.struts.action;import java.sql.ResultSet;import java.sql.SQLException;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;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.my.struts.form.BillForm;import com.my.struts.db.ConnOracle;/** * MyEclipse Struts Creation date: 08-04-2006 * * XDoclet definition: * * @struts.action path="/bill" name="billForm" input="/billAdd.jsp" * validate="true" */public class BillAction extends Action { // --------------------------------------------------------- Instance // Variables // --------------------------------------------------------- Methods /** * Method execute * * @param mapping * @param form * @param request * @param response * @return ActionForward * @throws SQLException */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws SQLException { BillForm billForm = (BillForm) form; ConnOracle conn = new ConnOracle(); ResultSet rs = null; rs = conn .executeQuery("select vendor_id from table_vendor where vendor_name='" + billForm.getVendorName() + "'"); rs.next(); String vendor_id = rs.getInt(1) + ""; String billdate = billForm.getBilldate(); String billduedate = billForm.getBillduedate(); String vendorname = billForm.getVendorName(); rs = conn.executeQuery("select count(*) from table_bill"); rs.next(); String bill_id = rs.getInt(1) + ""; conn.executeUpdate("insert into table_bill values(" + bill_id + "," + vendor_id + ",'" + billdate + "','" + billduedate + "',0,0)"); HttpSession session = request.getSession(); session.setAttribute("bill_id", bill_id); session.setAttribute("vendor_id", vendor_id); session.setAttribute("billdate", billdate); session.setAttribute("billduedate", billduedate); session.setAttribute("vendorname", vendorname); return mapping.findForward("billAddDepItem"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -