fix<页面结构调整>

master
liyansheng 2024-12-22 21:02:08 +08:00
parent e2b6123de8
commit 61cb1dec77
9 changed files with 155 additions and 28 deletions

View File

@ -26,7 +26,7 @@ public class LoginServlet extends HttpServlet {
User user = userService.login(username, password);
if(user!=null){
req.getSession().setAttribute("user",user);
resp.sendRedirect("/index.jsp");
resp.sendRedirect("/computer?action=list");
}else{
req.getSession().setAttribute("msg","用户名或密码错误");
resp.sendRedirect("/msg.jsp");

View File

@ -9,8 +9,33 @@
<title>购物车</title>
</head>
<body>
<div>
<h2>电脑商城</h2>
<p>你好!${sessionScope.user.username}</p>
<c:if test="${sessionScope.user!= null}">
<a href="/computer?action=list">电脑选购</a>
<c:if test="${sessionScope.user.role == 'user'}">
<a href="/cart?action=list">我的购物车</a>
<a href="/orders?action=my">我的订单</a>
</c:if>
<c:if test="${sessionScope.user.role == 'admin'}">
<a href="/user?action=list">用户列表</a>
<a href="/orders?action=all">所有订单</a>
</c:if>
<a href="/logout">退出</a>
</c:if>
<c:if test="${sessionScope.user == null}">
<p>请登录后查看更多内容~</p>
<br>
<a href="/register">注册</a>
<a href="/login">登录</a>
</c:if>
</div>
<h1>购物车</h1>
<a href="/">主页</a>
<c:if test="${not empty computers}">
<table border="1">
<thead>

View File

@ -20,6 +20,6 @@
<input type="submit" value="我已确认">
</form>
<br>
<a href="/">主页</a>
</body>
</html>

View File

@ -11,6 +11,31 @@
</head>
<body>
<div>
<h2>电脑商城</h2>
<p>你好!${sessionScope.user.username}</p>
<c:if test="${sessionScope.user!= null}">
<a href="/computer?action=list">电脑选购</a>
<c:if test="${sessionScope.user.role == 'user'}">
<a href="/cart?action=list">我的购物车</a>
<a href="/orders?action=my">我的订单</a>
</c:if>
<c:if test="${sessionScope.user.role == 'admin'}">
<a href="/user?action=list">用户列表</a>
<a href="/orders?action=all">所有订单</a>
</c:if>
<a href="/logout">退出</a>
</c:if>
<c:if test="${sessionScope.user == null}">
<p>请登录后查看更多内容~</p>
<br>
<a href="/register">注册</a>
<a href="/login">登录</a>
</c:if>
</div>
<h1>电脑产品列表</h1>
<table border="1">
<thead>
@ -80,7 +105,7 @@
<a href="/computer?action=add">发布电脑产品</a>
</c:if>
<br>
<a href="/">主页</a>
</body>
</html>

View File

@ -3,7 +3,8 @@
<html>
<body>
<script src="https://www.liyansheng.top/cdn/watermark.js"></script>
<h2>电脑商城-首页</h2>
<div>
<h2>电脑商城</h2>
<p>你好!${sessionScope.user.username}</p>
<c:if test="${sessionScope.user!= null}">
<a href="/computer?action=list">电脑选购</a>
@ -25,6 +26,7 @@
<a href="/register">注册</a>
<a href="/login">登录</a>
</c:if>
</div>
</body>

View File

@ -9,6 +9,31 @@
<title>我的订单</title>
</head>
<body>
<div>
<h2>电脑商城</h2>
<p>你好!${sessionScope.user.username}</p>
<c:if test="${sessionScope.user!= null}">
<a href="/computer?action=list">电脑选购</a>
<c:if test="${sessionScope.user.role == 'user'}">
<a href="/cart?action=list">我的购物车</a>
<a href="/orders?action=my">我的订单</a>
</c:if>
<c:if test="${sessionScope.user.role == 'admin'}">
<a href="/user?action=list">用户列表</a>
<a href="/orders?action=all">所有订单</a>
</c:if>
<a href="/logout">退出</a>
</c:if>
<c:if test="${sessionScope.user == null}">
<p>请登录后查看更多内容~</p>
<br>
<a href="/register">注册</a>
<a href="/login">登录</a>
</c:if>
</div>
<h1>我的订单</h1>
<div style="color: red;">
@ -42,6 +67,6 @@
</table>
<br/>
<br>
<a href="/">主页</a>
</body>
</html>

View File

@ -11,6 +11,31 @@
</head>
<body>
<div>
<h2>电脑商城</h2>
<p>你好!${sessionScope.user.username}</p>
<c:if test="${sessionScope.user!= null}">
<a href="/computer?action=list">电脑选购</a>
<c:if test="${sessionScope.user.role == 'user'}">
<a href="/cart?action=list">我的购物车</a>
<a href="/orders?action=my">我的订单</a>
</c:if>
<c:if test="${sessionScope.user.role == 'admin'}">
<a href="/user?action=list">用户列表</a>
<a href="/orders?action=all">所有订单</a>
</c:if>
<a href="/logout">退出</a>
</c:if>
<c:if test="${sessionScope.user == null}">
<p>请登录后查看更多内容~</p>
<br>
<a href="/register">注册</a>
<a href="/login">登录</a>
</c:if>
</div>
<h1>订单列表</h1>
<a href="/orders?action=all">全部</a> |
<a href="/orders?action=waiting">待发货</a> |
@ -52,7 +77,7 @@
</table>
<br />
<br>
<a href="/">主页</a>
</body>
</html>

View File

@ -15,6 +15,6 @@
<p>${requestScope.msg}</p>
</div>
<br>
<a href="/">主页</a>
</body>
</html>

View File

@ -9,6 +9,31 @@
<title>系统用户</title>
</head>
<body>
<div>
<h2>电脑商城</h2>
<p>你好!${sessionScope.user.username}</p>
<c:if test="${sessionScope.user!= null}">
<a href="/computer?action=list">电脑选购</a>
<c:if test="${sessionScope.user.role == 'user'}">
<a href="/cart?action=list">我的购物车</a>
<a href="/orders?action=my">我的订单</a>
</c:if>
<c:if test="${sessionScope.user.role == 'admin'}">
<a href="/user?action=list">用户列表</a>
<a href="/orders?action=all">所有订单</a>
</c:if>
<a href="/logout">退出</a>
</c:if>
<c:if test="${sessionScope.user == null}">
<p>请登录后查看更多内容~</p>
<br>
<a href="/register">注册</a>
<a href="/login">登录</a>
</c:if>
</div>
<h1>系统用户</h1>
<table border="1">
<thead>
@ -36,6 +61,6 @@
</table>
<br/>
<!-- <a href="/adduser">Add New user</a> -->
<a href="/">主页</a>
</body>
</html>