Tuesday 15 September 2015

java - load a jsp in a dialog and div -



java - load a jsp in a dialog and div -

i know might duplication question, couldn't find reply simple question. want load new jsp file in dialog , div.

structure: -webcontent -jsp -viewfolder -helloworld.jsp -helloworldedit.jsp -newworld.jsp

let's have helloworld.jsp loaded request dispatcher. want load newworld.jsp in div tag in helloworld.jsp.

<div id="result"></div> $('#result').load('/jsp/viewfolder/newworld.jsp');

tried above code, didn't work.

i have tried load jsp page dialog , 1 has failed too.

<button id="button">button</button> <div id="dialog"></div> $('#button').on("click", function() { $('#dialog').load('/jsp/viewfolder/helloworldedit.jsp').dialog(); });

the question have is, right way phone call jsp page or have load page request dispatcher using ajax.

to test if path correct, tried set calendar.gif in same folder , able reach context.

http://localhost:port/.projectcontext/jsp/viewfolder/calendar.gif.

you have wait dom ready event:

$(document).ready(function() { $('#button').on("click", function() { $('#dialog').load('/.projectcontext/jsp/viewfolder/helloworldedit.jsp').dialog(); }); });

java javascript jquery jsp

No comments:

Post a Comment