高人解答,在response里修改cookie
是这样的request.getSession()会创建一个保存JSESSIONID的cookie加入到response里面。我想修改这个cookie,可response没有提供接口啊?!
有办法吗?
------解决方案--------------------你 request.getSession() 获取cookie, 修改后,
再 response.addCookie(new Cookie(// 修改后的cookie)); 不就可以了吗?
------解决方案--------------------Cookie cookiename = new Cookie( "ewayusername ", username);
Cookie cookiepwd = new Cookie( "ewayuserpwd ", password);
int vt = 0;
if(valitime.equals( "year "))
vt = 0x1e13380;
if(valitime.equals( "month "))
vt = 0x278d00;
if(valitime.equals( "weekday "))
vt = 0x93a80;
if(valitime.equals( "day "))
vt = 0x15180;
if(valitime.equals( "hour "))
vt = 3600;
cookiename.setMaxAge(vt);
cookiepwd.setMaxAge(vt);
response.addCookie(cookiename);
response.addCookie(cookiepwd);