问答详情
源自:8-8 使用Cookie实现保存商品浏览记录

Cookie保存怎么有问题啊》???

Type Exception Report

Message An exception occurred processing [/details.jsp] at line [69]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.apache.jasper.JasperException: An exception occurred processing [/details.jsp] at line [69]

66: cookieList +=request.getParameter("id")+",";//灏嗕紶杩囨潵鐨勬柊id瀛楃涓蹭繚瀛樺埌cookieList涓紝骞朵互鈥橈紝鈥欏垎鍓�
67: Cookie cookie=new Cookie("cookieList",cookieList);//濡傛灉cookies==null,绗竴娆′繚瀛榗ookieList瀵硅薄
68: //灏哻ookie瀵硅薄淇濆瓨鍒板鎴风
69: response.addCookie(cookie);
70:
71:      %>
72: <%


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:593)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:482)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause

java.lang.IllegalArgumentException: An invalid character [44] was present in the Cookie value
org.apache.tomcat.util.http.Rfc6265CookieProcessor.validateCookieValue(Rfc6265CookieProcessor.java:182)
org.apache.tomcat.util.http.Rfc6265CookieProcessor.generateHeader(Rfc6265CookieProcessor.java:115)
org.apache.catalina.connector.Response.generateCookieString(Response.java:982)
org.apache.catalina.connector.Response.addCookie(Response.java:934)
org.apache.catalina.connector.ResponseFacade.addCookie(ResponseFacade.java:385)
org.apache.jsp.details_jsp._jspService(details_jsp.java:209)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:444)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Note The full stack trace of the root cause is available in the server logs.


提问者:Dream2018 2018-03-18 11:42

个回答

  • qq_枫吖_0
    2018-03-21 20:31:37
    已采纳

    换一下那个分隔符,换成"#"就行了

  • qq_枫吖_0
    2018-03-21 20:25:56

    巧了,我也是