jsp登陆校验演示 servlet、login、success(2)

<%@ page language="java" import="java.util.Date" pageEncoding="UTF-8"%> <%@ page language="java" import="java.text.SimpleDateFormat"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "https://www.jb51.net/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="https://www.jb51.net/<%=basePath%>"> <title>My JSP 'success-page-2.jsp' starting page</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"> <!-- <link type="text/css" href="https://www.jb51.net/styles.css"> --> </head> <% String username = (String) session.getAttribute("username"); if (null == username) { request.setAttribute("fdbkMsg", "呵呵嗒,这里是你来的地方吗?快登陆!"); //转发到登录界面: request.getRequestDispatcher("/LOGIN-DEMO/Login.jsp").forward( request, response); } SimpleDateFormat sDateFormat = new SimpleDateFormat("a"); Date today = new Date(); String am_pm_str = sDateFormat.format(today); String am_pm_str_in_chinese = ""; if ("am".equalsIgnoreCase(am_pm_str)) { am_pm_str_in_chinese = "上午"; } else am_pm_str_in_chinese = "下午"; // set null; sDateFormat = null; today = null; am_pm_str = null; %> <body> <br /> <font><b><%=username%><%=am_pm_str_in_chinese%>好,能来到页面2真不简单.</b> </font> </body> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzjxdy.html