ment3.jsp
上传用户:xjrzjk
上传日期:2022-07-31
资源大小:1585k
文件大小:7k
- <%@ page contentType="text/html; charset=GBK" %>
- <%@ page import="java.sql.*"%>
- <%@ page import="java.text.DecimalFormat"%>
- <%
- try{
- String Id = (String)request.getSession(true).getAttribute("LoginSuccess");
- String productList = (String)request.getSession(true).getAttribute("productList");
- if (productList == null || productList.equals("")){
- response.sendRedirect("nothing.jsp");
- return;
- }
- //数据库连接
- 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 * from product where product_id in (" + productList + ")";
- ResultSet rs = st.executeQuery(sql);
- %>
- <html>
- <head>
- <title>
- 商品结算
- </title>
- <link rel="stylesheet" type="text/css" href="style.css">
- </head>
- <BODY>
- <BR><BR>
- <FORM name=FORM1 action=ment4.jsp method=post>
- <%
- 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 strAddress = request.getParameter("Address");
- strAddress = new String(strAddress.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");
- %>
- <input type=hidden Name="UserId" Value="<%=strUserId%>" >
- <input type=hidden Name="Name" Value="<%=strName%>" >
- <input type=hidden Name="Address" Value="<%=strAddress%>" >
- <input type=hidden Name="Zip" Value="<%=strZip%>" >
- <input type=hidden Name="Phone" Value="<%=strPhone%>" >
- <input type=hidden Name="Email" Value="<%=strEmail%>" >
- <input type=hidden Name="Pays" Value="<%=strPays%>" >
- <input type=hidden Name="Remark" Value="<%=strRemark%>" >
- <div align="center">
- <center>
- <TABLE cellSpacing=0 cellPadding=0 width=362>
- <TBODY>
- <TR>
- <TD align=middle width="372">
- <TABLE cellSpacing=1 cellPadding=4 width=508 bgColor=#000000 class=main1>
- <TBODY>
- <TR vAlign=top bgColor=#eeeeee>
- <TD colSpan=4 width="494" bgcolor="#EEEEEE">购物结算--(第三步)信息确认</TD></TR>
- <tr>
- <TD width=482 bgcolor=#EEEEEE height=7 align="right" colspan="4">
- <div align="center"><center>
- <table border="1" cellpadding="0" cellspacing="0" width="524" bordercolor="#000000" height="61">
- <tr bgcolor="#006699">
- <td align="center" width="80" height="20" bgcolor="#006699"><font color="#FFFFFF">商品编号</font></td>
- <td align="center" width="170" height="20" bgcolor="#006699"><font color="#FFFFFF">商品名称</font></td>
- <td align="center" width="76" height="20" bgcolor="#006699"><font color="#FFFFFF">商品价格</font></td>
- <td align="center" width="67" height="20" bgcolor="#006699"><font color="#FFFFFF">商品数量</font></td>
- <td align="center" width="83" height="20" bgcolor="#006699"><font color="#FFFFFF">总价</font></td>
- </tr>
- <%
- double Sum = 0;
- int Quatity = 0;
- DecimalFormat df = new DecimalFormat("0.00");
- while(rs.next()){
- String strQuatity = (String)request.getSession(true).getAttribute(rs.getString("Product_Id"));
- if (strQuatity == null || strQuatity.equals("")){
- Quatity = 1;
- }else{
- Quatity = Integer.parseInt(strQuatity);
- if (Quatity <=0){
- Quatity = 1;
- }
- }
- request.getSession(true).setAttribute(rs.getString("Product_Id"), String.valueOf(Quatity));
- Sum = Sum + rs.getDouble("P_NewPrice") * Quatity;
- %>
- <tr>
- <td align="center" width="80" height="23"><%=rs.getString("Product_ID")%>
- </td>
- <td align="center" width="170" height="23"><%=rs.getString("Product_Name")%>
- </td>
- <td align="center" width="76" height="23"><%=df.format(rs.getDouble("P_NewPrice"))%>
- </td>
- <td align="center" width="67" height="23"><%=Quatity%></td>
- <td Align="center" width="83" height="23"><%=df.format(rs.getDouble("P_NewPrice") * Quatity)%>元
- </td>
- </tr>
- <%
- }
- %>
- <tr>
- <td Align="Right" ColSpan="6" width="520" height="12"><font Color="Red">总价格=人民币 <%=Sum%>元</font></td>
- </tr>
- </table>
- </center></div><blockquote>
- </blockquote>
- </TD>
- </tr>
- <tr>
- <TD width=103 bgcolor=#EEEEEE height=7 align="right">收货人姓名:</TD>
- <TD width=379 height=7 bgcolor="#EEEEEE" colspan="3"><%=strName%></TD>
- </tr>
- <tr>
- <TD width=103 bgcolor=#EEEEEE height=7 align="right">收货人地址:</TD>
- <TD width=379 height=7 bgcolor="#EEEEEE" colspan="3"><%=strAddress%></TD>
- </tr>
- <tr>
- <TD width=103 bgcolor=#EEEEEE height=7 align="right">邮政编码:</TD>
- <TD width=127 height=7 bgcolor="#EEEEEE"><%=strZip%></TD>
- <TD width=106 height=7 bgcolor="#006699">
- <p align="center"><font color="#FFFFFF">联系电话:</font> </TD>
- <TD width=146 height=7 bgcolor="#EEEEEE"><%=strPhone%></TD>
- </tr>
- <tr>
- <TD width=103 bgcolor=#EEEEEE height=7 align="right">电子信箱:</TD>
- <TD width=379 height=7 bgcolor="#EEEEEE" colspan="3"><%=strEmail%></TD>
- </tr>
- <tr>
- <TD width=103 bgcolor=#EEEEEE height=7 align="right">付款方式:</TD>
- <TD width=379 height=7 bgcolor="#EEEEEE" colspan="3"><%=strPays%></TD>
- </tr>
- <tr>
- <TD width=103 bgcolor=#EEEEEE height=7 align="right">订单备注:</TD>
- <TD width=379 height=7 bgcolor="#EEEEEE" colspan="3"><%=strRemark%></TD>
- </tr>
- <TR vAlign=top bgColor=#eeeeee>
- <TD colSpan=4 width="494" bgcolor="#EEEEEE"></TD></TR>
- <TR bgColor=#eeeeee>
- <TD colSpan=4 width="494" bgcolor="#EEEEEE">
- <DIV align=center><input type="button" value="上一步" name="B4" onclick="javascript:window.history.go(-1)">
- <INPUT class=main type=submit size=3 value=提交定单 name=Submit2>
- </DIV></TD></TR></TBODY></TABLE>
- </TD></TR></TBODY></TABLE></center>
- </div>
- <BR></FORM>
- </BODY>
- </html>
- <%
- }catch(Exception e){
- throw (e);
- }
- %>