什么是Cookie呢?——找度娘问问
Cookie,有时也用其复数形式 Cookies,指某些网站为了辨别用户身份、进行 session 跟踪而储存在用户本地终端上的数据(通常经过加密)。定义于 RFC2109 和 2965 中的都已废弃,最新取代的规范是 RFC6265[1] 。(可以叫做浏览器缓存)
中文名 储存在用户本地终端上的数据 外文名 Cookie
贴上代码
<!--CookieTest.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>
<script type="text/javascript">
function resetValue(){
document.getElementById("user").value="";
<!--备注:这里获取的是元素的id值-->
document.getElementById("pwd").value="";
}</script>
</head>
<body>
<%
String name=null;
String pwd= null;
Cookie[] allCookie=request.getCookies();
//for(int i=0;allCookie[i]!=null&&i<allCookie.length;i++){
//这里注释的是自己最初写错的代码
for(int</