I know this might be a duplication question, but I couldn't find the answer for this simple question. I want to load a new jsp file in a dialog and a div.
Structure:
-WebContent
-jsp
-viewfolder
-helloworld.jsp
-helloworldedit.jsp
-newworld.jsp
let's say I have helloworld.jsp
which is loaded from request dispatcher. I want to load newworld.jsp
in a div tag in helloworld.jsp
.
<div id="result"></div>
$('#result').load('/jsp/viewfolder/newworld.jsp');
Tried the above code, didn't work.
I have also tried to load a jsp page into a dialog and this one 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 I have is, this is the right way to call the jsp page or do I have to load the page from request dispatcher using ajax.
To test if the path is correct, I tried to put a calendar.gif
in the same folder and I was able to reach it from the context.
http://localhost:port/.projectcontext/jsp/viewfolder/calendar.gif.