• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ajax not loading .html file in a jsp page

 
Antigoni Tsouri
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Antigoni Tsouri
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic