今天想学一下jsp的cookie结果出现一大堆错误,请帮帮忙

来源:百度知道 编辑:UC知道 时间:2024/06/01 05:48:20
编写了两个页面,一个事test1.jsp另外一个是test2.jsp
其中test1.jsp是
<%@ page="contentType="text/html; charset="GB2312"%>
<%
String username = " ",password=" ";
Cookie temp=null;
Cookie cookies[]=request.getCookies();
int cookielen=cookies.length;
for(int i = 0;i<cookielen;i++)
{
temp=cookies[i];
if(temp.getName().equals("Name"))
{
Username=temp.getValue();
}
else if(temp.getName().equals("pass"))
{
password=temp.getvalue();
}
}
%>
<html>
<head>

</head>

<body>
<form action="test2.jsp">
<input type="text" name="user" value=<%=username%>/><br>
<input type="text" name="pass" value=<%=password%>/><br>
<input type="submit" value="提交" />
<inp

<%@ page="contentType="text/html; charset="GB2312"%>
你的这个jsp头标签写错了应该是
<@page contentType="text/html;charset=GBK">

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
.....
汗,这种问题也问,,,,,,