JSP(9) - 增加商品模組
以下模組無要點技術資訊,放在此處僅為系統的完整性考慮。
該模組增加商品種類資訊。
[@more@]add_comm_bef.jsp:
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader("Expires", 0); //prevents caching at the proxy server
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Date d = new Date();
DateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINESE);
%>
<!--
-->
add_comm_aft.jsp:
String sCommID = request.getParameter("comm_id");
String sCommName = request.getParameter("comm_name");
String sCommCate = request.getParameter("comm_type");
String sCommUnit = request.getParameter("comm_unit");
String sCommColor = request.getParameter("comm_color");
String sCommSize = request.getParameter("comm_size");
String sCommUptDate = request.getParameter("comm_upt_date");
String sCommID2 = new String(sCommID.getBytes("iso-8859-1"),"GBK");
String sCommName2 = new String(sCommName.getBytes("iso-8859-1"),"GBK");
String sCommCate2 = new String(sCommCate.getBytes("iso-8859-1"),"GBK");
String sCommColor2 = new String(sCommColor.getBytes("iso-8859-1"),"GBK");
String sCommSize2 = new String(sCommSize.getBytes("iso-8859-1"),"GBK");
if (sCommID.equals("")){
throw new Exception("商品編號不準為空");
}
if (sCommName.equals("")){
throw new Exception("商品名稱不準為空");
}
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@TCSCH074.tcsgdccn.com:1521:orcl";
//orcl為你的資料庫的SID
String user="store";
String password="store";
Connection conn= DriverManager.getConnection(url,user,password);
String sInsert = null;
Statement stmt = null;
String sCommQutt = request.getParameter("comm_qutt");
try{
sInsert = "insert into commodity (comm_id, comm_name, comm_cate, comm_unit, comm_qutt,";
sInsert = sInsert + "comm_upt_date, comm_color, comm_size) values(";
sInsert = sInsert + "'"+sCommID2+"','"+sCommName2+"','"+sCommCate2+"','"+sCommUnit;
sInsert = sInsert + "',"+sCommQutt +",to_date('"+sCommUptDate+"','yyyy-mm-dd'),'"+sCommColor2+"','"+sCommSize2+"')";
//out.println(sInsert);
stmt = conn.createStatement();
stmt.execute(sInsert);
conn.commit();
out.println("增加商品"+sCommName2+"完成。");
}
catch (Exception e){
System.out.println("增加商品失敗!");
e.printStackTrace();
out.println("增加商品失敗!
");
out.println(e.getMessage());
out.println("");
}
finally {
if (stmt != null) stmt.close();
conn.close();
}
%>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/207/viewspace-800202/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 商品模組介面文件
- 商品模組設計
- Laravel——商品模組難點Laravel
- JSP 商品瀏覽[Web application]JSWebAPP
- 9.模組和包
- magento2 在小程式模組增加 ApiAPI
- PHP提供Oracle支援增加oci8模組PHPOracle
- Java 9 的模組(Module)系統Java
- 封裝模組實現商品增刪改查封裝
- JavaScript權威指南(9)——類和模組JavaScript
- Java 9 平臺模組系統初探Java
- 將ServiceLoader遷移到Java 9模組系統 - frankelJava
- btcpool礦池原始碼分析(9)-statshttpd模組解析TCP原始碼httpd
- phpcmsV9手機模組外掛,自帶模板PHP
- 掌握Java9模組化系統-基礎部分Java
- 掌握Java9模組化系統-進階部分Java
- 序列化模組,隨機數模組,os模組,sys模組,hashlib模組隨機
- 07-SpringBoot+MyBatis+Spring 技術整合實現商品模組的CRUD操作Spring BootMyBatis
- python 模組:itsdangerous 模組Python
- path模組 fs模組
- Python模組:time模組Python
- 9.Vue之webpack打包基礎---模組化思維VueWeb
- 為開源專案 go-gin-api 增加後臺任務模組GoAPI
- day18:json模組&time模組&zipfile模組JSON
- 【一文秒懂】電商系統商品模組初建分析與設計
- CommonJS模組 和 ECMAScript模組JS
- Python模組之urllib模組Python
- python模組之collections模組Python
- 初識ABP vNext(9):ABP模組化開發-檔案管理
- Java9系列第8篇-Module模組化程式設計Java程式設計
- SAP PM 入門系列9 – PM模組的User-Exits & BADIs
- noip模擬9[斐波那契·數顏色·分組](洛谷模擬測試)
- Laravel05電商實戰:一個小希望這本教程商品模組的商品SKU支援多維度設計,希望後面能夠對重點模組更加詳細設計Laravel
- 序列化模組,subprocess模組,re模組,常用正則
- 模組學習之hashlib模組
- 模組學習之logging模組
- 聊天模組及分享模組分享
- [Python模組學習] glob模組Python
- Python常用模組(random隨機模組&json序列化模組)Pythonrandom隨機JSON