Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 67637
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.
 
I promise I will be the best, most loyal friend ever! All for this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic