网上图书商城项目学习笔记-009退出功能
2016-01-26 16:41
337 查看
一、退出功能流程分析
二、代码
1.view层
1)top.jsp
2.servlet层
1)UserServlet.java
二、代码
1.view层
1)top.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>top</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <style type="text/css"> body { background: #15B69A; margin: 0px; color: #ffffff; } a { text-transform:none; text-decoration:none; color: #ffffff; font-weight: 900; } a:hover { text-decoration:underline; } </style> </head> <body> <h1 style="text-align: center;">传智播客网上书城系统</h1> <div style="font-size: 10pt; line-height: 10px;"> <%-- 根据用户是否登录,显示不同的链接 --%> <c:choose> <c:when test="${empty sessionScope.sessionUser }"> <a href="<c:url value='/jsps/user/login.jsp'/>" target="_parent">传智会员登录</a> | <a href="<c:url value='/jsps/user/regist.jsp'/>" target="_parent">注册传智会员</a> </c:when> <c:otherwise> 传智会员:${sessionScope.sessionUser.loginname } | <a href="<c:url value='/jsps/cart/list.jsp'/>" target="body">我的购物车</a> | <a href="<c:url value='/jsps/order/list.jsp'/>" target="body">我的传智订单</a> | <a href="<c:url value='/jsps/user/pwd.jsp'/>" target="body">修改密码</a> | <a href="<c:url value='/UserServlet?method=quit'/>" target="_parent">退出</a> </c:otherwise> </c:choose> </div> </body> </html>
2.servlet层
1)UserServlet.java
/** * 退出功能 * @param request * @param response * @return */ public String quit(HttpServletRequest request, HttpServletResponse response) { request.getSession().invalidate(); return "r:/jsps/user/login.jsp"; }
相关文章推荐
- jupyter
- JAVA通过POI实现多sheet导出功能
- POJ 2079 Triangle(凸包,最大三角形)
- JS上传多种类型参数
- 主成分分析PCA
- DWR由服务器端向客户端推送消息
- 线段树入门——Billboard
- [从头学数学] 第63节 数学广角──优化
- Software caused connection abort: socket write error
- adb命令 pm list packages(查看安装程序包名)
- python3.5学习笔记:linux6.4 安装python3 pip setuptools
- Jconsole Monitor[Tomcat]
- Installation Failed Invalid argument
- 【Hadoop】Windows下的Eclipse远程连接Linux下的Hadoop0.20.2
- JAVA字符串格式化-String.format()的使用
- struts2与spring整和时出现错误
- * 重新绘制UITableViewCell线的方法
- Java多线程基础(二)定时器类:Timer类和TimerTask类
- Hdu 1754 I Hate It
- 对栈,堆,静态区的认识和总结!