javascript - 在 iframe 中调用 jsp 页面

标签 javascript spring jsp iframe methods

我正在使用 JSP 页面和 Javascript 开发一个界面。我的项目结构如下所示。

project structure

在我的主 JSP 页面(veditor.jsp)中的 View 下,我有一个属性面板分区。

pic1

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() 方法中收到两个警报,但“属性”面板未加载,并且出现以下错误。

error

如上所示,当调用createTableForm(...)方法时,我需要在veditor中的iframe中调用selectClauseForm.jsp。 jsp.

这是因为我的 src 位置路径错误吗? 任何有关如何使用 Javascript 在 iframe 中加载 jsp 的建议都将受到高度赞赏,因为我是新手。

最佳答案

您可以关注此URL 。 加载jsp文件并将响应内容添加到div中。您可以在iframe中实现相同的效果。

关于javascript - 在 iframe 中调用 jsp 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46147998/

相关文章:

java - 如何检查您在diplaytag中传递的列表中的数据?

java - 在 Struts 2 中使用 OGNL 检查 "top"值的成员资格

javascript - 为什么我的正则表达式长度为 2?

spring - 使用 Spring Data JPA、Hibernate 和多事务管理器 : No bean named 'transactionManager' is defined

java - Spring获取当前ApplicationContext

java - 如何验证表单页面中的整数输入?

spring - 简单的JSp和servlet代码可以迁移到Spring框架吗?

javascript - Tablesorter - 按姓氏排序,忽略中间名/首选姓名

javascript - 给定一个数组和谓词,找到第一个匹配元素

javascript - 如何在 google-closure 接口(interface)中注释 @attributes