A.jsp页面跳转到B.jsp页面,把A中的参数带到B页面中:
方法1:A页面用隐藏值接受要传递的参数:
<input type="hidden" name="disId" value="" id="disId"/>
<input type="hidden" name="disName" value="" id="disName"/>
B页面用request接受:
01 | < p > |
02 | <%= request.getParameter("disId")%> |
03 | <% |
04 | String str=null; |
05 | if (request.getParameter("disName")!=null) { |
06 | str= new String( request.getParameter("disName").getBytes("ISO-8859-1"),"utf-8");//解决乱码 |
07 | } |
08 | %> |
09 | <%= str%> |
10 | </ p > |
1 | $.mobile.changePage('http://localhost:8082/filing/toAddStep1.htm?disId='+$(this).val()+'&&disName='+str+'', {transition:"none", showLoadMsg:true}); |
这里用的是jquery mobile中的页面切换
方法三:用html5本地缓存localStorage传递参数
扩展:
针对jquery mobile中切换页面js不执行的问题:
解决办法一:把js写在data-role="page"页面之内
<div data-role="page" data-title="" data-theme="b" id="home">
...........................
<script>
js代码
</script>
</div>
解决办法二:在切换页面的<a href="" data-ajax="false">设置属性data-ajax="false"
解决办法三:把js单独加载:
$.getScript("js/test.js");