最近系统迁移,从自己的机房迁移到公司的机房,因为公司是两个机房,每个机房两台服务器、
所以不能再项目中用session 要搞成cookie
碰到中文的问题
存的时候呀
Cookie tempInfoCookie = new Cookie("tempInfo", URLEncoder.encode(tempInfo.toString(), "UTF-8"));
response.addCookie(tempInfoCookie);
session.setAttribute("tempInfo", tempInfo);
取得时候
Cookie tempInfoCookie = CookieUtil.getCookie(request,"tempInfo");
JSONObject tempInfo = JSONObject.fromObject(java.net.URLDecoder.decode(tempInfoCookie.getValue()));
前端获取
$(function () { // 病人信息模板 var bianzhenBingRenTemplate = $("#bianzhenBingRenTemplate").text(); var dom = htmlBuild.build(bianzhenBingRenTemplate, g_prescription.bingRen); $("#bianzhenBingRenHtml").html(dom); debugger; var orgName=getCookie("orgName"); var h2s = document.getElementsByTagName("h2"); var zycfj = h2s[0].innerText; h2s[1].innerHTML =decodeURI(orgName)+ zycfj; h2s[2].innerHTML =decodeURI(orgName)+ zycfj; buildImtreatmentList(); });
特此记录一下