- <%@ page contentType="text/html; charset=GBK" %>
- <%@ page import="java.sql.*"%>
- <%@ page import="java.text.DecimalFormat"%>
- <%
- try{
- String strId = (String)request.getSession(true).getAttribute("LoginSuccess");
- String productList = (String)request.getSession(true).getAttribute("productList");
- if (productList == null || productList.equals("")){
- %>
- <jsp:forward page="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>
- <div align="center">
- <TABLE cellSpacing=0 cellPadding=0 width=600>
- <TR>
- <TD height=62 width="100%">
- <BR><BR>
- <%
- String strAddress = request.getParameter("Address");
- strAddress = new String(strAddress.getBytes("iso8859-1"),"gb2312");
- %>
- <FORM name=FORM1 action=ment3.jsp method=post>
- <input type=hidden Name="UserId" Value="<%=request.getParameter("UserId")%>">
- <input type=hidden Name="Name" Value="<%=request.getParameter("Name")%>" >
- <input type=hidden Name="Address" Value="<%=strAddress%>" >
- <input type=hidden Name="Zip" Value="<%=request.getParameter("Zip")%>" >
- <input type=hidden Name="Phone" Value="<%=request.getParameter("Phone")%>" >
- <input type=hidden Name="Email" Value="<%=request.getParameter("Email")%>" >
- <TABLE cellSpacing=0 cellPadding=0 width=100%>
- <TR>
- <TD align=middle width="100%">
- <div align="center">
- <TABLE cellSpacing=1 width=100% bgColor=#000000 >
- <TR vAlign=top bgColor=#eeeeee>
- <TD colSpan=2 width="574" bgcolor="#EEEEEE">
- <p align="center">购物结算--(第二步)购物信息及付款方式</p>
- </TD>
- </TR>
- <tr>
- <TD width=100% bgcolor=#EEEEEE height=7 align="right" colspan="2">
- <div align="center">
- <table border="0" cellspacing="1" width="580" height="61" bgcolor="#000000" bordercolorlight="#000000" bordercolordark="#FFFFFF">
- <tr bgcolor="#006699">
- <td align="center" width="85" height="20" bgcolor="#006699"><font color="#FFFFFF">商品编号</font></td>
- <td align="center" width="205" height="20" bgcolor="#006699"><font color="#FFFFFF">商品名称</font></td>
- <td align="center" width="87" 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="95" height="20" bgcolor="#006699"><font color="#FFFFFF">总价</font></td>
- </tr>
- <%
- double Sum = 0;
- DecimalFormat df = new DecimalFormat("0.00");
- int Quatity = 0;
- 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="85" height="23" bgcolor="#EEEEEE"><%=rs.getString("Product_ID")%></td>
- <td align="center" width="205" height="23" bgcolor="#EEEEEE"><%=rs.getString("Product_Name")%></td>
- <td align="center" width="87" height="23" bgcolor="#EEEEEE"><%=df.format(rs.getDouble("P_NewPrice"))%></td>
- <td align="center" width="76" height="23" bgcolor="#EEEEEE"><%=String.valueOf(Quatity)%></td>
- <td Align="center" width="95" height="23" bgcolor="#EEEEEE"><%=df.format(rs.getDouble("P_NewPrice") * Quatity)%>元</td>
- </tr>
- <%
- }
- %>
- <tr>
- <td Align="Right" ColSpan="6" width="572" height="12" bgcolor="#EEEEEE"><font Color="Red">总价格=人民币 <%=df.format(Sum)%>元</font></td>
- </tr>
- </table>
- </div>
- </TD>
- </tr>
- <tr>
- <TD width=124 bgcolor=#EEEEEE height=7>付款方式</TD>
- <TD width=438 height=7 bgcolor="#EEEEEE">
- <select size="1" name="Pays" style="font-size: 14px">
- <option>邮局汇款,款到发货</option>
- <option>现金支付,上门提货</option>
- <option>银行转帐,见票发货</option>
- </select>
- </TD>
- </tr>
- <tr>
- <TD width=124 bgcolor=#EEEEEE height=7>请给我们订单处理员留言</TD>
- <TD width=438 height=7 bgcolor="#EEEEEE"><textarea rows="6" name="Remark" cols="45" style="font-size: 10pt"></textarea> </TD>
- </tr>
- <TR vAlign=top bgColor=#eeeeee>
- <TD colSpan=2 width="574" bgcolor="#EEEEEE"></TD>
- </TR>
- <TR bgColor=#eeeeee>
- <TD colSpan=2 width="574" bgcolor="#EEEEEE">
- <DIV align=center>
- <INPUT class=main type=submit size=3 value=下一步 name=Submit2>
- </DIV>
- </TD>
- </TR>
- </TABLE>
- </div>
- </TD>
- </TR>
- </TABLE>
- <BR>
- </FORM>
- </TD>
- </TR>
- </TABLE>
- </div>
- </BODY>
- </html>
- <%
- }catch(Exception e){
- throw (e);
- }
- %>