@CHARSET "UTF-8";
.page {
margin: 0 auto;
width: 950px;
font-family: "Microsoft Yahei";
}
.page td {
padding-top: 0;
padding-bottom: 20px;
}
.pagetop {
width: 300px;
margin: 0 auto 0 auto;
text-align:center;
}
.pageL {
width: 260px;
margin: 80px auto 80px auto;
padding: 0 20px 0 20px;
border: 2px solid Gainsboro;
border-top: 1px solid orangered;
}
.pageR {
width: 335px;
margin: 30px auto 100px auto;
padding: 0 20px 0 20px;
border: 2px solid Gainsboro;
border-top: 1px solid orangered;
}
.hd {
font-family: "Microsoft Yahei";
width: 80px;
margin: 0 auto 0 auto;
padding: 0;
}
.submit {
width:80px;
height:30px;
margin: 0 auto 0 auto;
color: white;
background: orangered;
font-family: "Microsoft Yahei";
}
.button {
background-color: orangered;
color: white;
width: 60px;
height: 27px;
font-size: large;
}
label{
font-size:small;
color:red;
display: none;
}
table {border-collapse:collapse;border:none}
td{border:none}
ul,li{ margin:0; padding:0; }
ul { list-style:none; }
a:link, a:visited {
color:darkred;
text-decoration:none;
}
a:hover, a:active {
color:blue;
text-decoration:underline;
}
#header #navbar {background:orangered; padding:5px 0px 25px 5px; text-align:right; }
#header .menu { float:left; }
#header .menu ul li { float:left; margin:0px 2px; display:inline; }
#header .menu ul li a { display:block; padding:0px 20px; text-decoration:none; background:orange; }
#header .menu ul li.current a { font-weight:bold; background:white; }
#content { padding:4px 0; }
#content .list table { width:100%; text-align:center; font-size:14px;}
#content .list table tr th { line-height:26px; background:#ffeec2; border-top:1px solid #d3d3d3; border-bottom:1px solid #d3d3d3; }
#content .list th.author { width:250px; }
#content .list th.user { width:120px; }
#content .list th.price { width:120px; }
#content .list th.action { width:150px; }
#content .bookList table td { padding:10px 0; border-bottom:1px solid #8b8b8b; }
#content .bookList table td.title { font-weight:bold;text-align:center;font-size: large;}
#content .bookList table span { font-weight:bold;color: red;font-size:15px;}
#content .bookAdd {text-align:right;}
#content .bookAdd input{width:120px;height:30px;background:orangered;color: white;font-size: 15px;}
#content .bookList table tr.odd td { background:#f4faee; }
#content .bookDetail table { width:75%;}
#content .bookDetail table td { padding:10px 0; border-bottom:1px solid #8b8b8b;font-weight:bold;font-size: large;}
#content .bookDetail table td.info{width:150px;background:#ffeec2;}
#content .bookDetail table .input{ width:300px;}
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="indexTop.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>个人二手书交易市场-首页二手书列表</title>
<link href="mystyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page">
<div id="header">
<div class="pagetop">
<h1><a href="index.jsp">个人二手书交易市场</a></h1>
</div>
<div id="navbar">
<div class="menu">
<ul>
<li class="current"><a href="index.jsp">首页</a></li>
<li><a href="bookByBuyer">我买的书</a></li>
<li><a href="bookBySeller">我卖的书</a></li>
</ul>
</div>
</div>
</div>
<div id="content">
<div class="list bookList">
<form method="post" name="shoping" action="shopping">
<table>
<tr>
<th>书名</th>
<th class="author">作者</th>
<th class="price">价格(¥)</th>
<th class="action">操作</th>
</tr>
<c:forEach items="${books }" var="book">
<c:if test="${book.flag==0 }">
<tr>
<td class="title"><a href="bookDetail?bookid=${book.bookid }">${book.bookname }</a></td>
<td>${book.author }</td>
<td>${book.price }</td>
<td>
<c:if test="${book.seller==sessionScope.loginUser.username }">
<span>我的二手书</span>
</c:if>
<c:if test="${book.seller!=sessionScope.loginUser.username }">
<a href="bookDetail?bookid=${book.bookid }"><input type="button" value="购买" class="button"></a>
</c:if>
</td>
</tr>
</c:if>
</c:forEach>
</table>
</form>
</div>
<c:if test="${!empty sessionScope.loginUser}">
<div class="bookAdd">
<a href="bookAdd.jsp"><input type="button" value="添加二手书出售" ></a>
</div>
</c:if>
</div>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>个人二手书交易市场-用户注册</title>
<link href="mystyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery-2.1.4.js"></script>
<script type="text/javascript">
function check() {
var username = $("#username").val();
var pwd = $("#password").val();
var repwd = $("#repassword").val();
var telenumber = $("#telenumber").val();
var address = $("#address").val();
//验证用户名是否为空
if (username == "") {
$(function() {
$("#label1").show();
});
return false;
} else {
$(function() {
$("#label1").hide();
});
}
//验证密码是否为空
if (pwd == "") {
$(function() {
$("#label2").show();
});
return false;
} else {
$(function() {
$("#label2").hide();
});
}
//验证前后密码是否一致
if (repwd != pwd) {
$(function() {
$("#label").show();
});
return false;
} else {
$(function() {
$("#label").hide();
});
}
//验证电话号码是否为空
if (telenumber == "") {
$(function() {
$("#label4").show();
});
return false;
} else {
$(function() {
$("#label4").hide();
});
}
//验证地址是否为空
if (address == "") {
$(function() {
$("#label5").show();
});
return false;
} else {
$(function() {
$("#label5").hide();
});
}
return true;
}
$(document).ready(function() {
$("#registerform").submit(function() {
return check();
});
});
</script>
</head>
<body>
<div class="page">
<div class="pagetop">
<a href="index.jsp"><h2>个人二手书交易市场</h2></a>
</div>
<hr>
<div class="pageR">
<form name="registerform" id="registerform" method="post"
action="register" οnsubmit="return checkOK()">
<div class="hd">
<h3>用户注册</h3>
</div>
<table border="1">
<tr>
<td align="right">用户名:</td>
<td><input type="text" class="input" name="user.username" id="username" /> <br>
<label id="label1">用户名不能为空!</label></td>
</tr>
<tr>
<td align="right">密码:</td>
<td><input type="password" class="input" name="user.password" id="password" /> <br>
<label id="label2">密码不能为空!</label></td>
</tr>
<tr>
<td align="right">密码确认:</td>
<td><input type="password" class="input" name="repassword" id="repassword" /> <br>
<label id="label3">前后密码必须一致!</label></td>
</tr>
<tr>
<td align="right">联系电话:</td>
<td><input type="text" class="input" name="user.telenumber" id="telenumber" /> <br>
<label id="label4">联系电话不能为空!</label></td>
</tr>
<tr>
<td align="right">地址:</td>
<td><textarea rows="4" cols="30" name="user.address" id="address"></textarea> <br>
<label id="label5">地址不能为空!</label></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" class="submit" value="注册" /></td>
</tr>
</table>
</form>
<c:if test="${!empty sessionScope.registerError }">
<p style="color:red">${sessionScope.registerError }</p>
</c:if>
<%
session.setAttribute("registerError", "");
%>
</div>
</div>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="indexTop.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>个人二手书交易市场-书本详情</title>
<link href="mystyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page">
<div id="header">
<div class="pagetop">
<h1><a href="index.jsp">个人二手书交易市场</a></h1>
</div>
<div id="navbar">
<div class="menu">
<ul>
<li class="current"><a href="">书本详情</a></li>
<li><a href="index.jsp">首页</a></li>
<li><a href="bookByBuyer">我买的书</a></li>
<li><a href="bookBySeller">我卖的书</a></li>
</ul>
</div>
</div>
</div>
<div id="content">
<div class="list bookdetail">
<form method="post" name="bookDetail" action="bookDetail">
<table>
<tr style="border-top:1px solid black;">
<td class="info">书名</td>
<td>${book.bookname }</td>
</tr>
<tr>
<td class="info">作者</td>
<td>${book.author }</td>
</tr>
<tr>
<td class="info">出版社</td>
<td>${book.publisher }</td>
</tr>
<tr>
<td class="info">出版日期</td>
<td>${book.publishdate }</td>
</tr>
<tr>
<td class="info">价格(¥)</td>
<td>${book.price }</td>
</tr>
<tr>
<td class="info">卖家</td>
<td>
<c:if test="${book.buyer==sessionScope.loginUser.username }">
<a href="userDetail?username=${book.seller}">${book.seller }</a>
</c:if>
<c:if test="${book.buyer!=sessionScope.loginUser.username }">
${book.seller }
</c:if>
</td>
</tr>
<tr>
<td class="info">买家</td>
<td>
<c:if test="${book.seller==sessionScope.loginUser.username }">
<a href="userDetail?username=${book.buyer}">${book.buyer }</a>
</c:if>
<c:if test="${book.seller!=sessionScope.loginUser.username }">
${book.buyer }
</c:if>
</td>
</tr>
<tr>
<td class="info">出售状态</td>
<td>
<c:if test="${book.flag==0 }"><span>出售中</span></c:if>
<c:if test="${book.flag==1 }"><span>已被拍,等待卖家发货</span></c:if>
<c:if test="${book.flag==2 }"><span>卖家已发货,等待买家发货</span></c:if>
<c:if test="${book.flag==3 }"><span>交易完成</span></c:if>
</td>
</tr>
<tr>
<td class="info">操作</td>
<td >
<c:if test="${book.flag==0&&book.seller!=sessionScope.loginUser.username }">
<a href="bookUpdate?flag=1&id=${book.bookid }"><input type="button" value="确认购买" style="width:120px;" class="button"></a>
</c:if>
<c:if test="${book.flag==1&&book.seller==sessionScope.loginUser.username }">
<a href="bookUpdate?flag=2&id=${book.bookid }"><input type="button" value="确认发货" style="width:120px;" class="button"></a>
</c:if>
<c:if test="${book.flag==2&&book.buyer==sessionScope.loginUser.username }">
<a href="bookUpdate?flag=3&id=${book.bookid }"><input type="button" value="确认收货" style="width:120px;" class="button"></a>
</c:if>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</body>
</html>