fix<页面间的链接>
parent
dd7954c3b5
commit
eb29d0c258
|
@ -24,7 +24,7 @@ public class LoginFilter implements Filter {
|
||||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||||
HttpSession session = request.getSession(false);
|
HttpSession session = request.getSession(false);
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
if (requestURI.contains("login.jsp") || requestURI.contains("login")) {
|
if (requestURI.contains("login.jsp") || requestURI.contains("login") || requestURI.contains("/")) {
|
||||||
filterChain.doFilter(request, response);
|
filterChain.doFilter(request, response);
|
||||||
} else {
|
} else {
|
||||||
if (session!= null && session.getAttribute("user")!= null) {
|
if (session!= null && session.getAttribute("user")!= null) {
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<script src="https://www.liyansheng.top/cdn/watermark.js"></script>
|
<script src="https://www.liyansheng.top/cdn/watermark.js"></script>
|
||||||
<h2>电脑商城-首页</h2>
|
<h2>电脑商城-首页</h2>
|
||||||
<a href="/register">注册</a>
|
<c:if test="${sessionScope.user!= null}">
|
||||||
<a href="/login">登录</a>
|
|
||||||
<a href="/computerList">电脑列表</a>
|
<a href="/computerList">电脑列表</a>
|
||||||
<a href="/user?action=list">用户列表</a>
|
<a href="/user?action=list">用户列表</a>
|
||||||
<a href="/cart?action=list">我的购物车</a>
|
<a href="/cart?action=list">我的购物车</a>
|
||||||
<a href="/orders?action=all">所有订单</a>
|
<a href="/orders?action=all">所有订单</a>
|
||||||
<a href="/logout">注销登录</a>
|
<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>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -14,6 +14,7 @@
|
||||||
<label for="password">密码:</label>
|
<label for="password">密码:</label>
|
||||||
<input type="password" id="password" name="password" required><br><br>
|
<input type="password" id="password" name="password" required><br><br>
|
||||||
<button type="submit">登录</button>
|
<button type="submit">登录</button>
|
||||||
|
<a href="/register">没有账号?去注册</a>
|
||||||
</form>
|
</form>
|
||||||
<br>
|
<br>
|
||||||
${requestScope.msg}
|
${requestScope.msg}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<label for="phone">电话:</label>
|
<label for="phone">电话:</label>
|
||||||
<input type="text" id="phone" name="phone" required><br><br>
|
<input type="text" id="phone" name="phone" required><br><br>
|
||||||
<button type="submit">注册</button>
|
<button type="submit">注册</button>
|
||||||
|
<a href="/login">已有账号,去登录</a>
|
||||||
</form>
|
</form>
|
||||||
<br>
|
<br>
|
||||||
${requestScope.msg}
|
${requestScope.msg}
|
||||||
|
|
Reference in New Issue