首先是点击事件
var btn = '<a class="editcls" onclick="editRow(\''+rec.tiName+'\')"href="javascript:void(0)">排考</a>';
/** 跳转到排考*/
function editRow(tiName){
//alert(title);
console.log("editRow");
console.log(tiName);
$('#rightP').panel({
title:'排考',
href:'yyj/pk?tiName='+tiName,
left:0,
collapsible:false
});
}
/*排考*/
@RequestMapping("/pk")
public String yyj_pk(HttpSession session,HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException{
System.out.println("ControllerColumnitem - yyj_pk");
System.out.println("tiName="+request.getParameter("tiName"));
session.setAttribute("tiName",request.getParameter("tiName"));
session.getAttribute("tiName").toString();
// String tiName=(String)request.getAttribute("tiName");
return "yyj_ksxxwh/pk";
}
最后在下一个页面接收值 但是出现了乱码 该如何解决啊
用encodeURIComponent编码2次,java再解码,看这个:http://blog.csdn.net/whaosy/article/details/8776197
href:'yyj/pk?tiName='+encodeURIComponent(encodeURIComponent(tiName)),
排查一下页面和后台的编码格式是否一致
http://blog.sina.com.cn/s/blog_3d25e30f0100cyzm.html
http://fhqiwcw.iteye.com/blog/1439665
应该是格式问题,你的tiName传过去是=object??
乱码只需要检查三个地方,你网页的Encoding,服务器的Encoding还有过滤器的Encoding