• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

How do you include a JSP onload?

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have a jsp page which I want to be displayed only after the page has finished loading. I tried putting the jsp include statement at the end of my html code but it still finished loading first. Is it possible to include a jsp only after the page has finished loading? How do you do it without using any third party javascript library?

Below is how my current html looks like. The problem with this is Test.jsp is displayed first before the body. I want the body to be displayed first before Test.jsp.

What I want to happen:
 
Marshal
Posts: 67478
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot do this with any JSP mechanism; it requires JavaScript.

And while you don't need any 3rd-party library to use Ajax, doing this in jQuery is a single line, while doing it properly without a library will take dozens.
 
Kelly Powell
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Bear Bibeault: Thanks! Yes, I am thinking of including the JSP page using JavaScript. Unfortunately, I am not allowed to use any third party JavaScript library including JQuery. How do you include a JSP page using Javascript?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kelly Powell wrote:@Bear Bibeault: Thanks! Yes, I am thinking of including the JSP page using JavaScript. Unfortunately, I am not allowed to use any third party JavaScript library including JQuery. How do you include a JSP page using Javascript?



Break out some JavaScript resources and learn about the XMLHttpRequest object OR use an iframe.

Eric
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kelly Powell wrote:@Bear Bibeault: Thanks! Yes, I am thinking of including the JSP page using JavaScript. Unfortunately, I am not allowed to use any third party JavaScript library including JQuery. How do you include a JSP page using Javascript?




As mentioned already you can use AJAX etc........

Or include the jsp like your first code...n then make the result visible only after page loading.... by calling this at the end of page "window.onload=call function tht sets properties of visiblility".

Hope this helps!!
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bluzeee blu please check your Private messages.
 
Kelly Powell
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Eric Pascarello and Bharat Chowdary: Thanks for your help! Will try Bharat's suggestion to just set the visibility property of the element onload.
 
Yes, my master! Here is the tiny ad you asked for:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic