Cookie coo=coos[i];
//找到指定的Cookie
if(coo!=null&&coo.getName().equals("visits"))
{
//得到计数值
visits=Integer.parseInt(coo.getValue());
break;
}
//找到指定的Cookie
if(coo!=null&&coo.getName().equals("visits"))
{
//得到计数值
visits=Integer.parseInt(coo.getValue());
break;
}
Cookie coo=coos[i];
在这些地方要检查是不是为null
因为别人的浏览器可能松松禁止了COOKIES,所以可能会有NULL返回,你再调用它的属性或函数就会出java.lang.NullPointerException
了