日期:2014-05-17 浏览次数:20666 次
String cookieName = "username"; String cookieValue = ""; Cookie[] cookies = request.getCookies(); Cookie myCookie = null; if(null != cookies){ for(int k=0;k<cookies.length;k++){ if(cookies[k].getName().equals(cookieName)){ myCookie = cookies[k]; cookieValue =URLDecoder.decode(myCookie.getValue(),"UTF-8"); break; } } }
------解决方案--------------------
这个貌似可以用cookie实现。但是我对cookie的存取也不是蛮懂。等大神来指点吧