session.getAttribute亂碼

 

servlet:request.getSession().setAttribute("chosencity", city);放入session數據庫

JSP: String city=(String)session.getAttribute("chosencity");獲取session

發現JSP獲取city是亂碼,後續數據庫查找結果是空,報錯NULLpointerci

解決方法:過濾器設置爲UTF-8(GBK也不行)get

相關文章
相關標籤/搜索