日期:2014-05-18 浏览次数:20735 次
private String getUsername(HttpServletRequest request){
Cookie[] cookies = request.getCookies();
String username = "";
if(cookies!=null){
for (int i = 0; i < cookies.length; i++)
{
Cookie c = cookies[i];
System.out.println(c.getName()+"--"+c.getValue());
if(c.getName().equalsIgnoreCase("username"))
{
username = c.getValue();
}
}
}
return username;
}