File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes ajax not loading .html file in a jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "ajax not loading .html file in a jsp page" Watch "ajax not loading .html file in a jsp page" New topic
Author

ajax not loading .html file in a jsp page

Antigoni Tsouri
Greenhorn

Joined: Dec 18, 2012
Posts: 8
Hello there all,

I am trying to combine ajax with jsp pages.
In my .jsp page I have this block :

<div id="rightColumnInternalWrapper">
<div id="rightRightColumnWrapper">
</div>
<div id="rightLeftColumnWrapper">
</div>
</div>

I have my .html page with an html block and in my .js file I am trying to load the .html file into the .jsp page like this:



When I am clicking the respective child of the mainMenuList element I am getting the 404 error in the Network section of chrome developer tools,
so it means that tomcat cannot find the page, even though I mapped it into the DD.

Any ideas what am I doing wrong and tomcat cannot find the page?

Thank you all in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Antigoni Tsouri wrote:I am trying to combine ajax with jsp pages.

The fact that the page is generated form a JSP is completely irrelevant. When the response gets to the browser, it's just an HTML page like any other.

I have my .html page with an html block

Well, that's a problem. You can't shove an entire HTML page, including an <html> element, inside another HTML page.

The HTML fragment you are loading should not have <html> elements, and should only be the fragment of the HTML DOM that is legal to place at the point of insertion.

When I am clicking the respective child of the mainMenuList element I am getting the 404 error

Your HTML file is under WEB-INF which means it cannot be loaded directly via a URL. You'll either need to move it out of WEB-INF, or provide a controller that can forward to it.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Antigoni Tsouri
Greenhorn

Joined: Dec 18, 2012
Posts: 8
First of all, thanks for your immediate reply!

Actually it was just that the request.html was under the WEB-INF directory!

About the request.html page, I didn't have any <html> tags :-) , it was miswritting what you pointed out as a fragment.

Thanks a lot again!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

 
 
subject: ajax not loading .html file in a jsp page
 
Similar Threads
jQuery datepicker JSP question
Call servlet class from jsp?
retrieve check box value rendered dynamically by a javascript
Submit dynamically created form with jQuery
Struts 2.1.6: keeping information in the same div - using tree node