response.getWriter().write()大凡能直接接jsp,html的都可以用
response.getWriter().write()
凡是能直接接jsp,html的都可以用
response.getWriter().write(),用这种方式可以点对点解决乱码
function getMenuTree(){
alert(22);
$.ajax({
url:"${path}/tbPowerGroup/createMenuTree",
type:"post",
dataType:"html",
cache:false,
async:false,
data:{"accountid":"<%=accountId%>","path":"${path}"},
success:function(data){
$("#MenuTree").html(data);
},
error:function(retMsg){
try{
$.zd.alert('','获取菜单失败!');
}catch(eee){
}
}
});
}
@RequestMapping(value = "/createMenuTree")
public void createMenuTree(@RequestParam(value="path") String path,TbPowerGroupBeanVo to,Model model, HttpServletRequest request,HttpServletResponse response, HttpSession session) throws Exception {
System.out.println("=======================hgfhgfhgg====================="+path+"======="+to.getAccountid());
Map<String,Object> param = new HashMap<String,Object>();
Map<String,Object> paramSM = new HashMap<String,Object>();
CusUserBean getCusUser= CASUtil.getCusUser(request, session);
CusFirmBean cusfirm= tbPowerGroupBeanService.getCusFirm(getCusUser.getCustomerKey());
TbCusUserBean cus= tbPowerGroupBeanService.getTbCusUser(getCusUser.getCustomerKey());
BigDecimal userLeave =cus.getUserLevel();
Tree t = null;
String cus_trade_kind = "HA";
if(userLeave.intValue()==0){
param.put("CUSTOMER_KEY", getCusUser.getCustomerKey());
param.put("current_trade_kind", cus_trade_kind);
t=tbPowerGroupBeanService.getBigPowerMenu(param);
}else{
param.put("CUS_USER_KEY", cus.getCusUserKey());
param.put("current_trade_kind", cus_trade_kind);
t=tbPowerGroupBeanService.getSmallPowerMenu(paramSM);
}
model.addAttribute("leftMenuOfTree",new String(encapLeftMenuTreeJs(t,to.getAccountid(),path).getBytes("ISO-8859-1"),"UTF-8"));
response.setCharacterEncoding("UTF-8");
response.getWriter().write(encapLeftMenuTreeJs(t,to.getAccountid(),path));
System.out.println("=nihao =");
//return "/myaccount/myaccountMenuTree";
}