📄 order.jsp~3~
字号:
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="workM" scope="page" class="book.bk" />
<%
if(session.getAttribute("username")==null)
{
response.sendRedirect("login.html");
}
%>
<html>
<head>
<title>[详细资料]</title>
</head>
<body bgcolor="#FFFFFF">
<div align="center">
<form name="form1" method="post" action="submit_order.jsp">
<table width="100%" border="1">
<tr bgcolor="#9999FF">
<td colspan="2">
<div align="center"><b>请您详细填写以下资料,然后单击“发出订单”按钮</b></div>
</td>
</tr>
<tr>
<td width="12%" bgcolor="#FFCCCC">姓名:</td>
<td width="88%" bgcolor="#CCFFCC"><%=session.getAttribute("username")%></td>
</tr>
<tr>
<td width="12%" bgcolor="#FFCCCC">住址:</td>
<td width="88%" bgcolor="#CCFFCC">
<input type="text" name="address">
</td>
</tr>
<tr>
<td width="12%" bgcolor="#FFCCCC">电话:</td>
<td width="88%" bgcolor="#CCFFCC">
<input type="text" name="tel">
</td>
</tr>
<tr>
<td colspan=2>
<div align="center">
<input type="submit" name="Submit1" value="提交订单">
<a href="index.jsp">继续购书</a>
</div>
</td>
</tr>
</table>
</form>
<p>您选购了以下书籍:</p>
<table width="100%" border="0" align="center">
<tr bgcolor="#FFCCCC">
<td width="15%">
<div align="center"><font color="#0000FF">购买数量</font></div>
</td>
<td width="56%">
<div align="center"><font color="#0000FF">书名</font></div>
</td>
<td width="13%">
<div align="center"><font color="#0000FF">单价(元)</font></div>
</td>
<td width="16%">
<div align="center"><font color="#0000FF">总价格(元)</font></div>
</td>
</tr>
<%
//价格
double g_price,total_price;
g_price=0;
total_price=0;
//********
String sqlList="select * from 订单 where user_name='"+session.getAttribute("username")+"'";
ResultSet RSList=workM.executeQuery(sqlList);
try
{
while(RSList.next())
{
int b_num;
b_num=RSList.getInt("book_number");
%>
<tr bgcolor="#CCFFCC">
<td width="15%">
<div align="center"> <font color="#0000FF"> <%=b_num%>
<input type="hidden" name="book_number" size="4" value=<%=b_num%>>
</font></div>
</td>
<%
String sqlBook="select * from 书籍信息 where id="+RSList.getInt("book_id");
ResultSet RSBook=workM.executeQuery(sqlBook);
while(RSBook.next())
{
%>
<td width="56%">
<div align="center"><font color="#0000FF"><%=RSBook.getString("name")%></font></div>
</td>
<td width="13%">
<%
double price;
price=RSBook.getDouble("price");
%>
<div align="center"><font color="#0000FF">¥<%=price%></font></div>
</td>
<td width="16%">
<div align="center"><font color="#0000FF">¥<%=(float)price*b_num%></font></div>
</td>
<%
g_price=g_price+(double)price*b_num;
}%>
</tr>
<%
}
}
catch(Exception e)
{
}
%>
<tr bgcolor="#CCCCFF">
<td colspan="3">
<div align="center"><font color="#0000FF">货物价格</font></div>
</td>
<td width="16%">
<div align="center"><font color="#0000FF">¥<%=(float)g_price%></font></div>
</td>
</tr>
<tr>
<td height="18" colspan="3" bgcolor="#CCCC99"><font color="#0000FF">
</font>
<div align="center"><font color="#0000FF">运输费用</font></div>
</td>
<td height="18" width="16%" bgcolor="#CCCC99">
<div align="center"><font color="#0000FF">¥5.00</font></div>
</td>
</tr>
<tr bgcolor="#66FF66">
<td colspan="3">
<div align="center"><b><font color="#FF0000">总费用</font></b></div>
</td>
<td width="16%">
<div align="center"><b><font color="#FF0000">¥<%=(float)g_price+5%></font></b></div>
</td>
</tr>
<tr align="center">
<td colspan="4">
</td>
</tr>
</table>
<p> </p>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -