JSP(10) - 修改商品資訊模組
upt_comm1.jsp:
請輸入要修改的商品的編號
<!---->
type="button" value="取消" name="cancel">
upt_comm2.jsp:
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
java.util.Date d = new java.util.Date();
DateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINESE);
%>
String sCommID = request.getParameter("comm_id");
String sCommName = "";
String sCommCate = "";
String sCommUnit = null;
String sCommQutt = null;
String sCommUptDt = null;
String sCommColor = "";
String sCommSize = "";
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);
ResultSet rs = null;
String sQuery = null;
Statement stmt = null;
try {
sQuery = "select COMM_ID, COMM_NAME, COMM_CATE, COMM_UNIT, COMM_QUTT,";
sQuery = sQuery + "to_char(COMM_UPT_DATE,'yyyy-mm-dd') COMM_UPT_DATE, COMM_COLOR, COMM_SIZE ";
sQuery = sQuery + "from commodity where comm_id = '"+sCommID+"'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sQuery);
while(rs.next())
{
sCommID = rs.getString("COMM_ID");
sCommName = rs.getString("COMM_NAME");
sCommCate = rs.getString("COMM_CATE");
if (sCommCate==null) sCommCate="";
sCommUnit = rs.getString("COMM_UNIT");
sCommQutt = rs.getString("COMM_QUTT");
sCommUptDt = rs.getString("COMM_UPT_DATE");
sCommColor = rs.getString("COMM_COLOR");
if (sCommColor==null) sCommColor="";
sCommSize = rs.getString("COMM_SIZE");
if (sCommSize==null) sCommSize="";
}
rs.close();
stmt.close();
conn.close();
}
catch (Exception e){ 檢索商品資訊失敗!
System.out.println("檢索商品資訊失敗!");
e.printStackTrace();
out.println("
out.println( e.getMessage() );
}
finally{
if(stmt != null) stmt.close();
conn.close();
}
%>
upt_comm3.jsp:
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
String sCommID = request.getParameter("comm_id");
String sCommName = request.getParameter("comm_name");
String sCommCate = request.getParameter("comm_cate");
String sCommUnit = request.getParameter("comm_unit");
String sCommQutt = request.getParameter("comm_qutt");
String sCommUptDt = request.getParameter("comm_upt_date");
String sCommColor = request.getParameter("comm_color");
String sCommSize = request.getParameter("comm_size");
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");
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 sUpdate = null;
Statement stmt = null;
try{
sUpdate = "update commodity set comm_cate='"+sCommCate2+
"',comm_unit="+sCommUnit+
",comm_color='"+sCommColor2+
"',comm_size='"+sCommSize2+
"',comm_upt_date=to_date('"+sCommUptDt+
"','yyyy-mm-dd') where comm_id='"+sCommID2+"'";
//out.println(sUpdate+" 修改商品資訊失敗!
");
stmt = conn.createStatement();
stmt.execute(sUpdate);
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-800203/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- JSP(5) - 修改客戶資訊模組JS
- JSP(9) - 增加商品模組JS
- JSP(12) - 商品處理模組JS
- 商品模組設計
- 商品模組介面文件
- Laravel——商品模組難點Laravel
- JSP 商品瀏覽[Web application]JSWebAPP
- JSP(11) - 退貨模組JS
- JSP(7) - 銷售模組JS
- JSP(6) - 進貨模組JS
- 京東商品資訊爬蟲爬蟲
- Springboot 多模組 jspSpring BootJS
- JSP(4) - 增加客戶模組JS
- jsp改造之sitemesh修改tagRuleJS
- 採集商品資訊對於商品分析的重要性
- GAT保險模組的修改
- 服裝系列基礎資訊:建立商品
- 封裝模組實現商品增刪改查封裝
- 淘寶API分享:獲取淘寶商品SKU資訊API
- git 修改 commit 資訊GitMIT
- [20181024]修改awr收集資訊設定.txt
- 電商設計手冊之基礎商品資訊
- Python實現拼多多商品資訊抓取方法Python
- 免費商品資訊查詢介面(條形碼)
- 報錯資訊 The jsp:param action must not be used outside the jsp:include, jsp:forward, or jsp:params elements 的原因及解決辦法JSIDEForward
- Git修改commit提交資訊GitMIT
- 修改oracle 的統計資訊Oracle
- iOS修改webview的UserAgent資訊.iOSWebView
- 透過1688店鋪所有商品API介面一鍵獲取店鋪所有商品資訊API
- Python爬蟲爬取淘寶,京東商品資訊Python爬蟲
- [Python3]selenium爬取淘寶商品資訊Python
- 淘寶API分享:淘寶/天貓批次獲取商品重量資訊API
- 爬蟲例項-淘寶頁面商品資訊獲取爬蟲
- 合理的商品結構規劃–資料資訊圖
- help:jbuilder中jsp修改後的執行問題UIJS
- B2B2C商品模組資料庫設計資料庫
- 穀粒商城day61-商品服務-API-新增商品-儲存SPU基本資訊+儲存SKU基本資訊+呼叫遠端服務儲存優惠等資訊API
- 手撕Vuex-提取模組資訊Vue