在C:\Documents and Settings\Administrator\Cookies
下面已经存在cookies值NB818906
NB818906
ID=565&TransactorID=2618&Password=123&MinCenterCode=06
10.74.56.2/
9728
4061971712
30110903
2407898208
30110702
*
但我在jsp中通过
<% Cookie allCookie[] = request.getCookies();
Cookie temp = null; if (allCookie!=null)
{
System.out.println("allCookie.length:"+allCookie.length);
for(int i=0;i<allCookie.length;i++){
temp = allCookie[i];
System.out.println("allCookie["+i+"].getName():"+allCookie[i].getName());
if(temp.getName().equals("NB818906"))
{
System.out.println("---"+allCookie[i].getValue());
}
}
}
else
{
System.out.println("null");
} %> 还是取不到NB818906这个键值?急.麻烦看下.谢谢了.
下面已经存在cookies值NB818906
NB818906
ID=565&TransactorID=2618&Password=123&MinCenterCode=06
10.74.56.2/
9728
4061971712
30110903
2407898208
30110702
*
但我在jsp中通过
<% Cookie allCookie[] = request.getCookies();
Cookie temp = null; if (allCookie!=null)
{
System.out.println("allCookie.length:"+allCookie.length);
for(int i=0;i<allCookie.length;i++){
temp = allCookie[i];
System.out.println("allCookie["+i+"].getName():"+allCookie[i].getName());
if(temp.getName().equals("NB818906"))
{
System.out.println("---"+allCookie[i].getValue());
}
}
}
else
{
System.out.println("null");
} %> 还是取不到NB818906这个键值?急.麻烦看下.谢谢了.
解决方案 »
- 我想在jsp页面里做个按钮,点击完可以选择备份到那个目录下。然后在java代码中得到这个路径,这个选择框怎么实现啊?
- MyEclipse中无法将SVN检出来的项目部署到tomcat中
- 怎么用JUnit3测试servlet
- 求高手啊!关于CHECKBOX提取值!
- 请问大家Overloaded的方法是可以改变返回值的类型?,Overlride的方法是可以改变返回值的类型?
- struts1.2中关於下拉框的问题
- JSP,文本编辑器,显示问题
- jxl 操作Excel日期转换问题
- ASP中的cstr()、cint()、clng()在JSP里分别是什么????
- 好心人,帮帮忙
- 我数据库中有两条符合条件的记录,为什么只能查出来一条呢,代码如下,请朋友们帮忙!!!
- 弱弱的问个问题 ?如何实现每个用户一个目录
没看出来
System.out.println("allCookie.length:"+allCookie.length);
输出来没有?
输出如下:
信息: Server startup in 28984 ms
目标编码:GB2312
null
第二次运行cookies.jsp
输出如下:
信息: Server startup in 28984 ms
目标编码:GB2312
null
目标编码:GB2312
allCookie.length:1
allCookie[0].getName():JSESSIONID
C:\Documents and Settings\Administrator\Cookies
这个下面,可以看得到.
下面找不到对应的文件,但我自已建的cookies可以取出来的.
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />
<title>cookie.jsp</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 rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<% Cookie allCookie[] = request.getCookies();
Cookie temp = null; if (allCookie!=null)
{
System.out.println("allCookie.length:"+allCookie.length);
for(int i=0;i<allCookie.length;i++){
temp = allCookie[i];
System.out.println("allCookie["+i+"].getName():"+allCookie[i].getName());
if(temp.getName().equals("NB818906"))
{
System.out.println("---"+allCookie[i].getValue());
}
}
}
else
{
System.out.println("null");
} %> </body>
</html:html>删除IEcookies后,
c:\Documents and Settings\Administrator\Cookies 下面只剩下index.dat文件.然后,我运行cookies.jsp文件,输出:
allCookie.length:1
allCookie[0].getName():JSESSIONID
我mail.163.com 保存cookies后,再运行cookies.jsp输出同上,没有编化