【JSP开源代码栏目提醒】:网学会员鉴于大家对JSP开源代码十分关注,论文会员在此为大家搜集整理了“fillorder.jsp”一文,供大家参考学习
<%@ page language="java" contentType="text/html; charset=GB2312"
pageEncoding="GB2312"%>
<%@ page import="java.util.Collection,java.util.Iterator"%>
<%@ page import="com.wxpn.tutorial.ec.bean.ECOrderItem"%>
<%@ include file="../include/header.jsp"%>
<%if (session.getAttribute("username") == null
|| session.getAttribute("username") == "") {
response.sendRedirect("../member/login.jsp?url="
+ request.getRequestURI());
}
%>
<html>
<head>
<title>填写订单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name != 'chkall'){
e.checked = form.chkall.checked;
}
}
}
function fSelectOne(obj)
{
if( obj.checked == false){
document.getElementsByName("chkall")[0].checked = obj.chcked;
}
}
</script>
</head>
<body bgcolor="#FFFFFF">
<div align="center">
<form name="form1" method="post" action="/ECommerce/OrderServlet">
<p>您的购物车中包含以下货物:</p>
<table width="80%" border="0" align="center">
<tr bgcolor="#FFCCCC">
<td width="10%">
<div align="left"><input type="checkbox" name="chkall" value="on"
onclick="CheckAll(this.form)" title='选中/取消选中 本页所有订单项'>全选/取消全选</div>
</td>
<td width="15%">
<div align="center"><b><font color="#0000FF">购买数量</font></b></div>
</td>
<td width="45%">
<div align="center"><b><font color="#0000FF">书名</font></b></div>
</td>
<td width="15%">
<div align="center"><b><font color="#0000FF">单价</font></b></div>
</td>
<td width="15%">
<div align="center"><b><font color="#0000FF">总价格</font></b></div>
</td>
</tr>
<%if (request.getAttribute("c") == null) {
%>
<tr>
<td width="" 75%"" colspan=5 bgcolor="#FCFCFC" align=center>还没有任何订单。</td>
</tr>
<%} else {
Collection c = (Collection) request.getAttribute("c");
if (c == null) {
%>
<tr>
<td width="" colspan=5 bgcolor="#FCFCFC" align=center>还没有任何订单。</td>
</tr>
<%} else {
Iterator iterator = c.iterator();
double allprice = 0;
while (iterator.hasNext()) {
ECOrderItem orderitem = (ECOrderItem) iterator.next();
%>
<tr bgcolor="#CCFFCC">
<td width="10%">
<div align="left"><input type="checkbox" name="itemid"
value="<%=orderitem.getId()%>" title="选择/不选"
onclick="fSelectOne(this)"></div>
</td>
<td width="15%">
<div align="center"><font color="#0000FF"> <%=orderitem.getBooknumber()%>
<input type="hidden" name="book_number" size="4"
value=<%=orderitem.getBooknumber()%>></font></div>
</td>
<td width="45%">
<div align="center"><font color="#0000FF"><%=orderitem.getBookname()%></font></div>
</td>
<td width="15%">
<div align="center"><font color="#0000FF">¥<%=orderitem.getGoods_price()%></font></div>
</td>
<td width="15%">
<div align="center"><font color="#0000FF">¥<%=(double) orderitem.getGoods_price()
* orderitem.getBooknumber()%></font></div>
</td>
</tr>
<%allprice = allprice
+ (double) orderitem.getGoods_price()
* orderitem.getBooknumber();
}
%>
<tr bgcolor="#CCCCFF">
<td colspan="4">
<div align="center"><font color="#0000FF">货物价格</font></div>
</td>
<td width="16%">
<div align="center"><font color="#0000FF">¥<%=allprice%></font></div>
</td>
</tr>
<tr>
<td height="18" colspan="4" 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="4">
<div align="center"><b><font color="#FF0000">总费用</font></b></div>
</td>
<td width="16%">
<div align="center"><b><font color="#FF0000">¥<%=allprice + 5%></font></b></div>
</td>
</tr>
<%}
}
%>
</table>
<table width="80%" border="1" align="center">
<tr bgcolor="#9999FF">
<td colspan="4">
<div align="center"><b>请您详细填写以下资料,然后单击“发出订单”按钮</b></div>
</td>
</tr>
<tr>
<td width="15%" bgcolor="#FFCCCC">:</td>
<td width="35%" bgcolor="#CCFFCC"><%=session.getAttribute("username")%></td>
<td width="15%" bgcolor="#FFCCCC">住址:</td>
<td width="35%" bgcolor="#CCFFCC"><input type="text" name="address"></td>
</tr>
<tr>
<td width="15%" bgcolor="#FFCCCC">电话:</td>
<td width="35%" bgcolor="#CCFFCC"><input type="text" name="tel"></td>
<td width="15%" bgcolor="#FFCCCC">身份证:</td>
<td width="35%" bgcolor="#CCFFCC"><input type="text" name="usercid"></td>
</tr>
<tr>
<td colspan=4>
<div align="center"><input type="submit" name="Submit2" value="提交订单">
<input type="button" value="继续购物" onClick="javascript:self.close();"
name="button"></div>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
上一篇:
file_upload_smart_form.jsp
下一篇:
成本管理详细介绍