• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do you include a JSP onload?

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
bluzeee blu please check your Private messages.
 
Kelly Powell
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic