Cookie免验证自动登录
来源:互联网 发布:mysql导出所有数据库 编辑:程序博客网 时间:2024/05/29 17:31
<!-- Login.jsp -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="T_Cookie.jsp">
用户:<input type="text" name="name"/><br><br>
<input type="submit" value="提交">
</form>
</body>
</html>
<!-- Cookie.jsp -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String name = request.getParameter("name");
//对name 跟 Cookie 进行判断
if(name != null && !name.trim().equals(""))
{
Cookie cookie = new Cookie("name",name);
//20秒生效
cookie.setMaxAge(20);
response.addCookie(cookie);
}else{
Cookie cookies[] = request.getCookies();
if(cookies != null && cookies.length>0)
{
for(Cookie cookie:cookies)
{
String cookie_name = cookie.getName();
if("name".equals(cookie_name))
{
name = cookie.getValue();
}
}
}
}
if(name != null && !name.trim().equals(""))
{
out.print("Hello: "+name);
}else{
response.sendRedirect("T_Login.jsp");
}
%>
</body>
</html>
- Cookie免验证自动登录
- spring mvc 用cookie和拦截器实现自动登录(/免登录)
- spring mvc 用cookie和拦截器实现自动登录(/免登录)
- session、cookie实现免登录
- iOS UIWebView 通过 cookie 完成自动登录验证
- iOS UIWebView 通过 cookie 完成自动登录验证
- iOS UIWebView 通过 cookie 完成自动登录验证
- iOS UIWebView 通过 cookie 完成自动登录验证
- iOS UIWebView 通过 cookie 完成自动登录验证
- iOS UIWebView 通过 cookie 完成自动登录验证
- iOS UIWebView 通过 cookie 完成自动登录验证
- iOS UIWebView 通过 cookie 完成自动登录验证
- ssh自动输入密码登录服务器/ssh免输入密码登录/非交互ssh 密码验证
- ssh自动输入密码登录服务器/ssh免输入密码登录/非交互ssh 密码验证
- ssh自动输入密码登录服务器/ssh免输入密码登录/非交互ssh 密码验证
- ssh自动输入密码登录服务器/ssh免输入密码登录/非交互ssh 密码验证
- 实现自动登录Cookie
- cookie自动登录认证
- cocos2dx在安卓6.0(android-23)以上版本打包
- 单例模式应用场景和设计失误所引发的问题
- 线段树 模板
- web特殊符号
- python的排序模块bisect
- Cookie免验证自动登录
- shell中的分支
- 【STL】STL空间配置器
- elasticsearch判断索引是否存在
- QT的 QButton 添加ICO 以及添加菜单 Action
- 16 - 12 - 11 HDU 1021 ---Fibonacci Again
- 数据绑定
- STL next_permutation(全排列算法)
- Java多线程——基本概念