request怎么能够取到session里面的值呢? 你肯定要用session去获取呀
前端代码 截全点。localStorage.setItem("selProId", provinceCode) 这句之后,到请求结束
http://blog.csdn.net/qq_38005982/article/details/76101116
我以前的一个,不知道对你有没有用,我是后台向前台传值,前台接收不到,后来才知道,要把Session先随便给一个页面预加载一下,你看看,不管用就算了
后台处理先获取session
HttpSession session = request.getSession()
String ProId = (String) session.getAttribute("selProId")
System.out.println(ProId);
获取不到,,,,那就是传入的问题了,,,你先试试
1、一定要用$("#selectedProvinceId").find("option:selected").val()吗,不是$("#selectedProvinceId").val()就能去到值了?$("#selectedProvinceId").find("option:selected").val()如果是多选,好像取值会有问题,单选好像也有 很遗憾忘了。。。
2、既然是放到了session中,那么在后台也应该用session取,单纯在request里取不到的
这样去取,另外可以通过ajax的方式往后台传递数据.
request.getSession().getAttribute("selProId");