..._java 后台携带cookie 跳转页面">
赞
踩
效果图:
代码:
index.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <form action="cookie/login" method="post"> 姓名:<input type="text" name="username"/><br/> 密码:<input type="text" name="password"/><br/> <input type="submit" value="登录"/> </form> </body> </html>
LoginServlet.java:
package text.cookie.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。