• 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

Checking for load finished

 
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using the following to load some default attributes and clear frame contents before a logon json command runs. How can I make sure the page is loaded before the logon code runs?



Here is my logon function which includes the code line above:

 
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
So you want to delay the execution of some code in the parent until the child loads?

If so, you can use the onload handler in the child to let the parent know it has executed.
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since my servlet does not actually post a response to an html page how can I use the onload event?
 
Bear Bibeault
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
A request always returns a response. If you have nothing to display, what's the purpose of opening a new window?
[ June 10, 2008: Message edited by: Bear Bibeault ]
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I now have the servlet responding to a blank html page. I have put in a javascript function to run in the onload event.

Now I have no idea what code I would put in the javascript function of the child or back in the parent to handle to tell the parent the child is loaded.

Also, when I use the window.open to populate a frame content the page loads forever until I click something on the loaded page. Clicking the stop loading button will not even work.
 
Bear Bibeault
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 still haven't answered my question. Why are you doing a window.open if you have nothing to display?
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that.

My main web page has three Frames. A header frame, navigation frame, and content frame. In the nav frame I have logon and log off links amoung others which depend on if user is logged on and authority settings). If a person logs on and clicks a link that they have access to it populates the content frame with that page which is set up according to their security settings. When the user clicks the logoff link a servlet is requested that sets certain attributed to default values, hides links in the nav frame as necessary, then displays a blank page in the content frame just in case it was loaded with content that is not authorized for guest.
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still need help on this issue.
 
Bear Bibeault
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

Originally posted by Steve Dyke:
Sorry about that.

My main web page has three Frames. A header frame, navigation frame, and content frame. In the nav frame I have logon and log off links amoung others which depend on if user is logged on and authority settings). If a person logs on and clicks a link that they have access to it populates the content frame with that page which is set up according to their security settings. When the user clicks the logoff link a servlet is requested that sets certain attributed to default values, hides links in the nav frame as necessary, then displays a blank page in the content frame just in case it was loaded with content that is not authorized for guest.



Nothing in this answers my question. Why the window.open()?
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure what you are asking anymore. The frame as I explained displays content on users request(a HTML page controled by the src value). The src value is a file, in my case a .jsp file. I use the window.open() to request a servlet to set some values and display contents in the frame. Please help me to know exactly what you are asking for. I seem to be missing the meaning of the question.
 
Bear Bibeault
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
Here's the disconnect:

Originally posted by Steve Dyke:
I use the window.open() to request a servlet to set some values and display contents in the frame.


window.open() is used to create a new browser window. How are you using it to display something within an existing frame? Why would you use it for such?
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If my content frame src is set to frame_d and I execute the following javascript code from my navigation frame the content frame displays the servlet requestdispatcher jsp link page.



This is obviously not the proper way do this with reguard to your previous post. Can you tell me how to handle this. I have this method used through out my application/
 
Bear Bibeault
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
The easiest way to change the frame source is to set the src attribute to a new value.
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, if I use the following javascript in my navigation frame will this be correct or do I need the JSON to return status so I will know the page is loaded?


[ June 12, 2008: Message edited by: Steve Dyke ]
 
Bear Bibeault
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
If you want to make sure that the getJSON request is finished before reloading the frame, then you need to move the reload code to a completion callback for the $.getJSON() call.
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well there is another problem. The servlet that I am calling is a doPost which if I use getJSON I never get a return. If I use jQuery.post I still don't get a return. What syntax do I use in the servlet for my call back using a jQuery.post call.
 
Bear Bibeault
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
Well of course if your servlet only supports POST, a GET won't work. You'll either need to modify the servlet or do a POST.

The best way to see what's going on with your Ajax requests is to use Firebug in Firefox which will show you exactly what was submitted in the request, and what was returned as the response.

The callback function is specified on the $.getJSON() method (or $.post() or whatever), not in the servlet. A servlet, or any other server-side resource, has no notion that an Ajax call is being made. It's just a request like any other.
 
reply
    Bookmark Topic Watch Topic
  • New Topic