wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes screen refresh Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "screen refresh" Watch "screen refresh" New topic
Author

screen refresh

S Chander
Greenhorn

Joined: Jun 13, 2002
Posts: 8
Hi,

Please redirect me to the appropriate thread if this has been discussed earlier.
I want to refresh HTML screens with updated information without reloading the screen again. The actual aim to refresh the screens without have constant flickering of the screens.I had been trying to have two frames. In one frame I tried to call a servlet to send the updated information. This servlet gets called every 5 seconds or so to check for periodic updates.
Now I want to display the fresh data in the second frame without repainting it. Is there any way to do it? Can I use a javascript function to populate the fresh data in the second frame?
If someone can send some code snippets explaining this it will be of immense help to me.
thanks in advance
chander
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
I did a demo some time ago with this technic.
if you have main page
<frameset cols="100%,*
<frame src=src1 name=content
<frame src=myservlet
</frameset
and your content frame has a
<form name=form1
<input name=in1
to update it your servlet should generate the following javascript:
top.document.form1.in1.value="new value"
I use this example, since input text is a simpliest thing that you could have. If you need a static text to be changed, you should wrap it into "span" with sertain id, so if
<span id=sp1
than to change the text:
top.document.getElementById("sp1").innerHTML="new value"
Note, that you will have a problem with doing span staff in NS4
it get more complicated, if need to change select's or add/remove some elements - I mean not just edit existing information.
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
Forgot to mention - it may be better to use <IFRAME in one page, instead of a <FRAMESET with frames.
So you will have only one page with hidden IFRAME that will reload your servlet, wich will generate JavaScript to update page content.
S Chander
Greenhorn

Joined: Jun 13, 2002
Posts: 8
Hi,
Thanks for the help Yuriy. I was able to test out a sample screen with your suggestions.
Chander
Charlie Sturman
Ranch Hand

Joined: Apr 04, 2002
Posts: 112
http://www-106.ibm.com/developerworks/web/library/wa-exrel/index.html?dwzone=web
hth
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: screen refresh