一、参数的封装:
1, A.jsp:(在div块中)
<jsp:include page="B.jsp">
<jsp:param name="jingdu" value="${customer.jingdu}"/>
<jsp:param name="weidu" value="${customer.weidu}"/>
</jsp:include>
2,(在<script>的js中)
layer.open({
type:2,
area:['100%','100%'],
offset:'auto',
content:"${pageContext.request.contextPath}/src/views/customer /selectmapforadd.jsp?jingdu="+'${customer.jingdu}'+"&weidu="+'${customer.weidu}'
})
(补:在此处不能用<%=request.getRequestDispatcher().forward(request,response)来实现页面的跳转)
3,(form监听提交时)
$.ajax({
type: "post",
url: "${pageContext.request.contextPath }/selectmap/updateSelectMap.action?mapid="+mapid,
data:$("#frm").serialize(),
//dataType: "json",
success: function(data) {} })
二、参数的获取
1,B.jsp:
var jingdu=<%=request.getParameter("jingdu")%>;
var weidu= <%=request.getParameter("weidu")%>;
2,同1.
3,自动在数据库中获取。
4,补:如果在B.jsp页面无法通过${id}或者${map.id}获取对应的id值,则需要在controller文件加下通过@requestMapp("xx")在xx方法里间接通过 return "B"跳转到B页面;//(视图解析器里要配置好前后缀)