我正在使用 JSP 页面和 Javascript 开发一个界面。我的项目结构如下所示。
在我的主 JSP 页面(veditor.jsp
)中的 View 下,我有一个属性面板分区。
veditor.jsp
...
<!--Container/Canvas-->
<div id="container" class="container">
</div>
<!--Properties Panel-->
<div style="float: left" class="property" id="propertypane">
<h1 class="toolbox-titlex" id="toolbox-titlex">Properties</h1>
<iframe class = "panel" id="lot"></iframe>
</div>
...
这里我需要使用 veditor.js
在属性面板中调用 veditor.jsp
的 iframe 中的 selectClauseForm.jsp
页面> JavaScript。
veditor.js
if (dropElem == "stream ui-draggable") {
var newAgent = $('<div>').attr('id', i).addClass('streamdrop');
var elemType = "table";
$("#container").addClass("disabledbutton");
$("#toolbox").addClass("disabledbutton");
$('#container').append(newAgent);
callSelectClauseForm();
}
function callSelectClauseForm()
{
alert("Called before");
document.getElementById("lot").src = 'selectClauseForm.jsp';
alert("Called after");
}
我在 callSelectForm()
方法中收到两个警报,但“属性”面板未加载,并且出现以下错误。
如上所示,当调用createTableForm(...)
方法时,我需要在veditor中的iframe中调用
. selectClauseForm.jsp
。 jsp
这是因为我的 src
位置路径错误吗?
任何有关如何使用 Javascript 在 iframe 中加载 jsp 的建议都将受到高度赞赏,因为我是新手。
最佳答案
您可以关注此URL 。 加载jsp文件并将响应内容添加到div中。您可以在iframe中实现相同的效果。
关于javascript - 在 iframe 中调用 jsp 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46147998/