2017-09-11 1 views
0

JSP 페이지와 Javascript를 사용하는 인터페이스에서 작업 중입니다. 내 프로젝트 구조가 여기에 표시됩니다. 뷰에서 내 주요 JSP 페이지 (veditor.jsp)에서iframe에서 jsp 페이지 호출

project structure

, 나는 속성 패널 부문이있다.

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 페이지를 호출해야합니다. 나는이 (가) callSelectForm() 메소드 내 경고하지만, 속성 패널이로드되지 않고 다음과 같은 오류를 얻고 둘을 얻고있다

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"); 
} 

는 veditor.js. 위와 같이 createTableForm(...) 메소드를 호출 할 때

error

는, I는 veditor.jsp에 Iframe에 내 selectClauseForm.jsp를 호출 할 필요가있다.

내 경로가 src 위치에 잘못 되었기 때문에이게 맞습니까? Javascript를 사용하여 iframe 내부에서 jsp를로드하는 방법에 대한 제안 사항은 새로운 것이므로 크게 감사하겠습니다.

답변

2

다음은 URL입니다. 어떤 jsp 파일을로드하고 div에 해당 응답 내용을 추가 할 수 있습니다. iframe에서 동일한 결과를 얻을 수 있습니다.

당신은 iframe이 SRC 내부의 URL을 호출 할 수 있습니다

다음
@Controller 
@RequestMapping(value = "clause") 
public class ClauseController { 

    @RequestMapping(value="selectClause") 
    public String selectClause(ModelMap model) { 
    return "selectClauseForm.jsp"; 
    } 
} 

다음과 같이이 JSP에 대한 컨트롤러 매핑을 할 수

0

,

function callSelectClauseForm() { 
    alert("Called before"); 
    document.getElementById("lot").src = 'clause/selectClause'; 
    alert("Called after"); 
}