严重: Servlet.service() for servlet [jsp] in context with path [/JspViewListDemo] threw exception [An exception occurred processing [details.jsp] at line [70]
67: }68: }
69: Cookie cookie = new Cookie("ListViewCookie",list);
70: response.addCookie(cookie);
71:
72: %>
73: <!-- 浏览过的商品 -->
Stacktrace:] with root cause
java.lang.IllegalArgumentException: An invalid character [44] was present in the Cookie value
https://www.imooc.com/qadetail/177191
list+=request.getParameter("id")+"#";
//如果浏览记录超过1000条,清零.
String[] arr = list.split("#");
if(arr!=null&&arr.length>0)
{
if(arr.length>=1000)
{
list="";
}
}
Cookie cookie = new Cookie("ListViewCookie",list);
response.addCookie(cookie);
将逗号,换成#,记得itemdao的方法也是