tomcat4和tomcat5在cookie的处理上有区别吗?下面语句在tomcat5中会出错,tomcat4中没问题!

时间:2023-01-10 18:00:52
Cookie deptCookie = new Cookie("deptname",deptname);
deptCookie.setMaxAge(365*24*60*60);//
response.addCookie(deptCookie);<-----出错
出错信息:

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: CT?
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause 

java.lang.IllegalArgumentException: CT?
org.apache.tomcat.util.http.ServerCookie.maybeQuote(ServerCookie.java:315)
org.apache.tomcat.util.http.ServerCookie.appendCookieValue(ServerCookie.java:248)
org.apache.coyote.tomcat5.CoyoteResponse.addCookie(CoyoteResponse.java:934)
org.apache.coyote.tomcat5.CoyoteResponseFacade.addCookie(CoyoteResponseFacade.java:317)
org.apache.jsp.reg_jsp._jspService(reg_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

5 个解决方案

#1


。。

#2


好象是你的tomcat5没有配置好吧!
你注意一下.http协议

#3


Cookie deptCookie = new Cookie("deptname",deptname);
deptname的类型没错吧

#4


Cookie deptCookie = new Cookie("deptname",deptname);
deptCookie.setMaxAge(365*24*60*60);//
response.addCookie(deptCookie);
这一段没错,错误可能在其它地方,楼主check 仔细了么?

#5


呵呵,就算真的有问题,呵呵,tomcat5.0也能兼容tomcat4的^_^

#1


。。

#2


好象是你的tomcat5没有配置好吧!
你注意一下.http协议

#3


Cookie deptCookie = new Cookie("deptname",deptname);
deptname的类型没错吧

#4


Cookie deptCookie = new Cookie("deptname",deptname);
deptCookie.setMaxAge(365*24*60*60);//
response.addCookie(deptCookie);
这一段没错,错误可能在其它地方,楼主check 仔细了么?

#5


呵呵,就算真的有问题,呵呵,tomcat5.0也能兼容tomcat4的^_^