An invalid character [32]

An invalid character [32] was present in the Cookie value
一个不识别的字符[32]出现在了cookie当中

	  Date date = new Date();
      SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
      String currentTime = format.format(date);
      Cookie cookie = new Cookie("accessTime",currentTime);
      cookie.setMaxAge(60*60*10);
      response.addCookie(cookie);

注意以上代码,其中错误所在 在于new SimpleDateFormat(“yyyy-MM-dd hh:mm:ss”),在格式化时间的时候 天和时之间产生了一个不是别的代码,去掉即可

猜你喜欢

转载自blog.csdn.net/syl2850246/article/details/88634974