摘要: <1> 什么是application? application 代表整个web程序, 整个服务器端只存在一个application对象, 当Tomcat启动的时候就被创建 application 的生命周期与Tomcat 同步 <2> 使用application储存网站当前登录人数, 并显示在首页 阅读全文
posted @ 2020-08-12 17:57 Jasper2003 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 需求: 在首页面显示 当前登录用户 <1> 前置知识: session 从打开这个网站开始, 到关闭这个网站结束, 视作一个session <2>. 示例: <% System.out.println(session); %> 效果: (在多个页面中, 输出session(的地址), 结果为相同的内 阅读全文
posted @ 2020-08-12 08:16 Jasper2003 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1. 处理登录失败的情况 <1> 在login_do.jsp中: if(user == null){ request.setAttribute("message","很遗憾, 由于用户名或密码错误,你登录失败了!"); // 给出提示信息 request.getRequestDispatcher(" 阅读全文
posted @ 2020-08-12 04:58 Jasper2003 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 1. 需求: 在登录之后, 跳转至个人中心 2. 在login_do.jsp 中 if(user == null){ out.println("很遗憾, 登录失败, 用户名或密码错误!"); }else{ request.setAttribute("user",user); request.getR 阅读全文
posted @ 2020-08-12 01:56 Jasper2003 阅读(194) 评论(0) 推荐(0) 编辑