📄 insert_backaction.java
字号:
// Created by Xslt generator for Eclipse.// XSL : not found (java.io.FileNotFoundException: (Bad file descriptor))// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xslpackage struts.action;import java.sql.ResultSet;import javabean.*;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 struts.form.Insert_backForm;/** * InsertAction.java created by EasyStruts - XsltGen. * http://easystruts.sf.net * created on 10-26-2004 * * XDoclet definition: * @struts:action path="/insert" name="insertForm" input="insert.jsp" validate="true" * @struts:action-forward name="/insert.jsp" path="/insert.jsp" */public class Insert_backAction extends Action { // --------------------------------------------------------- Instance Variables // --------------------------------------------------------- Methods /** * Method execute * @param ActionMapping mapping * @param ActionForm form * @param HttpServletRequest request * @param HttpServletResponse response * @return ActionForward * @throws Exception */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Insert_backForm insertForm = (Insert_backForm) form; ISOChange_back isochange=new ISOChange_back(); String kind=insertForm.getKind().trim(); String title=isochange.Change(insertForm.getTitle().trim()); String danwei=isochange.Change(insertForm.getDanwei()); String price=insertForm.getPrice(); String timedate=insertForm.getTimedate(); String excelname=insertForm.getExcelname(); String code=insertForm.getCode(); if(code!=null) { code=code.trim(); } if(excelname!=null) { excelname=isochange.Change(excelname.trim()); } DataBase_back DBase=new DataBase_back(); if(kind.equals("kind")) { String str0="select * from kind"; ResultSet rs=DBase.query(str0); if(!rs.next()) { code="1001"; } else { String str="select * from kind where title='"+title+"'"; rs=DBase.query(str); if(rs.next()) { rs.close(); return (mapping.findForward("error"));//s } String str1="select max(code) as code from kind"; rs=DBase.query(str1); if(rs.next()) { code=rs.getString("code").trim(); code=String.valueOf(Integer.parseInt(code)+1); } } String str2="insert into kind values('"+code+"','"+title+"','"+danwei+"')"; if(!DBase.Insert(str2)) { return (mapping.findForward("success")); } } if(kind.equals("data")) { float pri=0; try { pri=Float.parseFloat(price); } catch(Exception e) { return mapping.findForward("error"); } String str1="insert into data values("+pri+",'"+timedate+"','"+code+"')"; if(!DBase.Insert(str1)) { return (mapping.findForward("error")); } } if(kind.equals("excel")) { if(!DBase.ExceltoOracle(code,excelname)) { return mapping.findForward("error"); } } return (mapping.findForward("success")); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -