• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Load jsp into div tag of another jsp

 
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to load a jsp page into div tag of another jsp using the onload event for this i have used




but the above is not working and i am getting the file name BatchJobControl.jsp as text in the div tag instead of the page getting loaded.

Please suggest me how do i load a jsp into div tag.
 
Ranch Hand
Posts: 190
jQuery Postgres Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code

document.getElementById('bjdivload').innerHTML = '/BatchJobControl.jsp';


doesn't actually 'call' the jsp, the innerHTML property just takes this as a string literal, so that is why you are seeing the string /BatchJobControl.jsp

the resulting html would simply look something like this


I'm not too sure if what you are attempting is possible in such a simple way, I would suggest using an iFrame and set the window.location = "....../BatchJobControl.jsp" for it, or, pull the html of the server in the form of a string using ajax and then use the innerHTML property to place that string inside the selected element (this is what I do but I don't use a jsp, I build the string directly)


 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another option is to learn about Ajax.

Eric
 
Sheriff
Posts: 67269
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just use a JSP include?
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i just include the page .. the included page's onLoad event is not getting fired? even if i use Ajax the onload in not getting fired.




How do i fire the onload event of the included page...
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can not just stick an entire page into the page with innerHTML and expect it to work. First it is invalid html [think you have html inside of html and heads and bodies galore. Second inline JavaScript is not executed since there is no load event.

I think you would be better off with an iframe.

Eric
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main jsp in which i am including child jsp is under a particular tab. and when i navigate between tabs the iframe(present in main jsp) is loading the child jsp again. I dont want to load the page even if navigate between tabs thats the reason i dont want to use iframe.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!