ment4.jsp
上传用户:xjrzjk
上传日期:2022-07-31
资源大小:1585k
文件大小:6k
- <%@ page contentType="text/html; charset=GBK" %>
- <%@ page import="java.sql.*"%>
- <%
- try{
- String productList = (String)request.getSession(true).getAttribute("productList");
- String strFlags = "尚未处理";
- if (productList == null || productList.equals("")){
- response.sendRedirect("nothing.jsp");
- }
- //数据库连接
- Class.forName("oracle.jdbc.driver.OracleDriver");
- String strUrl = "jdbc:oracle:thin:@slight:1521:LOCAL";
- String strUser = "eshop";
- String strPassword = "eshop";
- Connection con = DriverManager.getConnection(strUrl, strUser, strPassword);
- Statement st = con.createStatement();
- //保存购买者信息
- //获得定单号
- String sql = "select max(nvl(form_id,0))+1 as formid from orderlist";
- ResultSet rs = st.executeQuery(sql);
- long longId = 0;
- if (rs.next()){
- longId = rs.getLong("formid");
- }
- rs.close();
- String strUserId = request.getParameter("UserId");
- strUserId = new String(strUserId.getBytes("iso8859-1"),"gb2312");
- String strName = request.getParameter("Name");
- strName = new String(strName.getBytes("iso8859-1"),"gb2312");
- String strZip = request.getParameter("Zip");
- strZip = new String(strZip.getBytes("iso8859-1"),"gb2312");
- String strPhone = request.getParameter("Phone");
- strPhone = new String(strPhone.getBytes("iso8859-1"),"gb2312");
- String strEmail = request.getParameter("Email");
- strEmail = new String(strEmail.getBytes("iso8859-1"),"gb2312");
- String strPays = request.getParameter("Pays");
- strPays = new String(strPays.getBytes("iso8859-1"),"gb2312");
- String strRemark = request.getParameter("Remark");
- strRemark = new String(strRemark.getBytes("iso8859-1"),"gb2312");
- String strAddress = request.getParameter("Address");
- strAddress = new String(strAddress.getBytes("iso8859-1"),"gb2312");
- sql = "insert into orderlist values(" + longId + ",'" + strUserId +"','"+
- strName + "','" + strZip + "','" + strPhone + "','" + strEmail + "','" +
- strAddress + "','" + strPays + "',sysdate,'" + strFlags + "','" + strRemark + "')";
- st.executeUpdate(sql);
- sql = "select * from product where product_id in (" + productList + ") order by product_no";
- rs = st.executeQuery(sql);
- ResultSet rs1 = null;
- Statement st1 = con.createStatement();
- long longId1 = 0;
- String strProductName = "";
- String strProductId = "";
- double dbPrice = 0;
- while (rs.next()){
- int Quatity = 0;
- strProductId = rs.getString("product_id");
- String strQuatity = (String)request.getSession(true).getAttribute(strProductId);
- if (strQuatity == null || strQuatity.equals("")){
- Quatity = 1;
- }else{
- Quatity = Integer.parseInt(strQuatity);
- if (Quatity <=0){
- Quatity = 1;
- }
- }
- strProductName = rs.getString("product_name");
- dbPrice = rs.getDouble("p_newprice");
- sql = "select max(nvl(id,0))+1 as id from shoplist";
- rs1 = st1.executeQuery(sql);
- if (rs1.next()){
- longId1 = rs1.getLong("id");
- }
- rs1.close();
- sql = "insert into shoplist(id,product_id,form_id,product_name,number1,p_newprice,regtime) values(" +
- longId1 + ",'" + strProductId + "'," +
- longId + ",'" + strProductName + "'," + Quatity + "," + dbPrice + ",sysdate)";
- st.executeUpdate(sql);
- }
- //request.getSession(true).setAttribute("ProductList", null);
- %>
- <html>
- <head>
- <title>
- 提交成功
- </title>
- <link rel="stylesheet" type="text/css" href="style.css">
- </head>
- <body bgcolor="#ffffff">
- <p align="center">北京市内,货到付款! </p>
- <div align="center">
- <TABLE cellSpacing=0 cellPadding=0 width=341>
- <TR>
- <TD align=middle width="342">
- <TABLE cellSpacing=0 cellPadding=0 width=373 bgColor=#006699>
- <TR>
- <TD height=2 width="113" bgcolor="#006699"></TD>
- <TD height=2 width="256" bgcolor="#006699"></TD>
- </TR>
- </TABLE>
- <div align="center">
- <TABLE cellSpacing=1 width=373 bgColor=#416327 height="123" >
- <TR vAlign=top bgColor=#eeeeee>
- <TD width="373" height="76" colspan="2" bgcolor="#EEEEEE">
- <br />
- 订单提交成功,您的订单号是:<%=longId%>
- <p>我们即可按您的订单发货,请牢记您的订单号,以便查询。请你把钱寄到以下地方!</p>
- </TD>
- </TR>
- <TR bgColor=#eeeeee>
- <TD width="70" height="27" bgcolor="#EEEEEE">汇款地址</TD>
- <TD width="303" height="27" bgcolor="#EEEEEE"> 北京市西大街超人大楼4楼</TD>
- </TR>
- <TR bgColor=#eeeeee>
- <TD width="70" height="27" bgcolor="#EEEEEE">收款人</TD>
- <TD width="303" height="27" bgcolor="#EEEEEE"> **先生</TD>
- </TR>
- <TR bgColor=#eeeeee>
- <TD width="70" height="27" bgcolor="#EEEEEE">帐户</TD>
- <TD width="303" height="27" bgcolor="#EEEEEE"> 中国银行北京支行(0111123)</TD>
- </TR>
- <TR bgColor=#eeeeee>
- <TD width="373" height="27" colspan="2" bgcolor="#EEEEEE">
- <h2 align="center"><input type="button" name="close" value="关闭窗口" onClick="window.close()"></h2>
- </TD>
- </TR>
- </TABLE>
- </div>
- <TABLE cellSpacing=0 cellPadding=0 width=373 bgColor=#006699>
- <TR>
- <TD width=119 height=2 bgcolor="#006699"></TD>
- <TD width=272 height=2 bgcolor="#006699">
- <DIV align=right style="width: 212; height: 19"></DIV>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
- </TABLE>
- </div>
-
- </body>
- </html>
- <%
- }catch(Exception e){
- throw e;
- }
- %>