JSP父页面传参数到子页面及接收示例
时间:2020-12-25 11:46:08|栏目:JSP代码|点击: 次
1、父页面传参数到子页面
//JavaScript代码
$.ajax({
type:"POST",
uri:"../student/studentInfo.action",
data:{
"date":date,
"stuNo":stuNo
},
success:function(data){
var params = "?date="+date+"&stuNo="+stuNo;
var action = '../../page/studentInfo.jsp?'+params;
dojo.byId("student").src = action;
}
});
<iframe src="../../page/studentInfo.jsp" id="student" ></iframe>
2、子页面接受父页面的参数
var params = {
'date':'{param.date}',
'stuNo':{param.stuNo}
};
复制代码 代码如下:
//JavaScript代码
$.ajax({
type:"POST",
uri:"../student/studentInfo.action",
data:{
"date":date,
"stuNo":stuNo
},
success:function(data){
var params = "?date="+date+"&stuNo="+stuNo;
var action = '../../page/studentInfo.jsp?'+params;
dojo.byId("student").src = action;
}
});
复制代码 代码如下:
<iframe src="../../page/studentInfo.jsp" id="student" ></iframe>
2、子页面接受父页面的参数
复制代码 代码如下:
var params = {
'date':'{param.date}',
'stuNo':{param.stuNo}
};