Connecting Tech Pros Worldwide Forums | Help | Site Map

force to refresh browser

Jay
Guest
 
Posts: n/a
#1: Jul 20 '05
I'm trying to refresh browser when some new information is available in DB.
is there any way to force to refresh browser?
Thanks.

-Kev






kaeli
Guest
 
Posts: n/a
#2: Jul 20 '05

re: force to refresh browser


In article <bpdmsu$df5$1@msunews.cl.msu.edu>, no@spam.com enlightened us
with...[color=blue]
> I'm trying to refresh browser when some new information is available in DB.
> is there any way to force to refresh browser?
> Thanks.
>[/color]


window.location.reload(true);

Beware infinite refresh if not in a function!

--
~kaeli~
Is it possible to be totally partial?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#3: Jul 20 '05

re: force to refresh browser


Thanks!

well, window.location.reload(true) does whenever control is hit that line,
it does refresh.
What I want to do is server side trigger send message to client browser to
refresh it.

-Kev



"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a2425a2bcf0f48c98997e@nntp.lucent.com...[color=blue]
> In article <bpdmsu$df5$1@msunews.cl.msu.edu>, no@spam.com enlightened us
> with...[color=green]
> > I'm trying to refresh browser when some new information is available in[/color][/color]
DB.[color=blue][color=green]
> > is there any way to force to refresh browser?
> > Thanks.
> >[/color]
>
>
> window.location.reload(true);
>
> Beware infinite refresh if not in a function!
>
> --
> ~kaeli~
> Is it possible to be totally partial?
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


kaeli
Guest
 
Posts: n/a
#4: Jul 20 '05

re: force to refresh browser


In article <bpdrs7$ht0$1@msunews.cl.msu.edu>, no@spam.com enlightened us
with...[color=blue]
> Thanks!
>
> well, window.location.reload(true) does whenever control is hit that line,
> it does refresh.
> What I want to do is server side trigger send message to client browser to
> refresh it.
>[/color]

Technically, you can't in a normal cross-browser internet environment
(that is, activeX, applets, and COM notwithstanding).

If the page should be refreshed every so often, put it in a setTimeout.
This is common.

If the user updates the DB via a popup with the main window on a
particular page you want to refresh, write a script as output to the
popup that calls window.opener.location.reload(true).

Other situation, please elaborate. We can probably find something that
works for you.

--
~kaeli~
A backward poet writes... inverse.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#5: Jul 20 '05

re: force to refresh browser


Thank you for your help.
I'm displaying hotel information from DB.

What I want to is
First, I will get the hotel list and display with no rate. ( since getting
rate takes time)
Whenever rate information is ready to update. refresh user's browser.

but how?

Thanks.
-Kev





"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a243ffb568759c9989982@nntp.lucent.com...[color=blue]
> In article <bpdrs7$ht0$1@msunews.cl.msu.edu>, no@spam.com enlightened us
> with...[color=green]
> > Thanks!
> >
> > well, window.location.reload(true) does whenever control is hit that[/color][/color]
line,[color=blue][color=green]
> > it does refresh.
> > What I want to do is server side trigger send message to client browser[/color][/color]
to[color=blue][color=green]
> > refresh it.
> >[/color]
>
> Technically, you can't in a normal cross-browser internet environment
> (that is, activeX, applets, and COM notwithstanding).
>
> If the page should be refreshed every so often, put it in a setTimeout.
> This is common.
>
> If the user updates the DB via a popup with the main window on a
> particular page you want to refresh, write a script as output to the
> popup that calls window.opener.location.reload(true).
>
> Other situation, please elaborate. We can probably find something that
> works for you.
>
> --
> ~kaeli~
> A backward poet writes... inverse.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


kaeli
Guest
 
Posts: n/a
#6: Jul 20 '05

re: force to refresh browser


In article <bpe1vp$no9$1@msunews.cl.msu.edu>, no@spam.com enlightened us
with...[color=blue]
> Thank you for your help.
> I'm displaying hotel information from DB.
>
> What I want to is
> First, I will get the hotel list and display with no rate. ( since getting
> rate takes time)
> Whenever rate information is ready to update. refresh user's browser.
>
> but how?
>[/color]

If you are getting the hotel list from the DB, getting the rate should
take an inconsequential amount of time, especially if the DB is set up
properly and a concise SQL statement is used. Views can be helpful for
this if the rate is a calculated field or is keyed by a number rather
than a hotel name.
Rates do not change often enough to need to refresh the user's browser
more than with a setTimeout for some amount of time.
Perhaps what you really need is help with your SQL query.

If you're not getting the hotel list from the DB, why not? That is much
easier than manually changing pages. :)
The DB must have the hotels in there or it would be impossible to look
up rates.

How I would do this: query the DB for the list of hotels and rates and
write the whole thing dynamically at once. I do much more complicated
things with billing data for one of my pages and it takes less than 10
seconds to run and load.

--
~kaeli~
Not one shred of evidence supports the notion that life is
serious.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#7: Jul 20 '05

re: force to refresh browser


Thanks.

I did not explained in detail so I can avoid some confusions.
But I guess it did more harm than good.

Hotel list are coming from our DB and rate are coming from GDS in XML.
I have a java object created with list first and displays and trying to
update as soon as I got XML response.

XML response is quite slow. ( you know there is nothing I can do).
I can wait XML and display all together. but I'm just seeking a way to
display list of hotel first with some animation indicating
rate is being updated and display rate when it's available.

is that make sense now?

-Kev




"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a253468f5aba909989985@nntp.lucent.com...[color=blue]
> In article <bpe1vp$no9$1@msunews.cl.msu.edu>, no@spam.com enlightened us
> with...[color=green]
> > Thank you for your help.
> > I'm displaying hotel information from DB.
> >
> > What I want to is
> > First, I will get the hotel list and display with no rate. ( since[/color][/color]
getting[color=blue][color=green]
> > rate takes time)
> > Whenever rate information is ready to update. refresh user's browser.
> >
> > but how?
> >[/color]
>
> If you are getting the hotel list from the DB, getting the rate should
> take an inconsequential amount of time, especially if the DB is set up
> properly and a concise SQL statement is used. Views can be helpful for
> this if the rate is a calculated field or is keyed by a number rather
> than a hotel name.
> Rates do not change often enough to need to refresh the user's browser
> more than with a setTimeout for some amount of time.
> Perhaps what you really need is help with your SQL query.
>
> If you're not getting the hotel list from the DB, why not? That is much
> easier than manually changing pages. :)
> The DB must have the hotels in there or it would be impossible to look
> up rates.
>
> How I would do this: query the DB for the list of hotels and rates and
> write the whole thing dynamically at once. I do much more complicated
> things with billing data for one of my pages and it takes less than 10
> seconds to run and load.
>
> --
> ~kaeli~
> Not one shred of evidence supports the notion that life is
> serious.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


kaeli
Guest
 
Posts: n/a
#8: Jul 20 '05

re: force to refresh browser


In article <bpg1ei$2j5i$1@msunews.cl.msu.edu>, no@spam.com enlightened
us with...[color=blue]
> I did not explained in detail so I can avoid some confusions.
> But I guess it did more harm than good.
>
> Hotel list are coming from our DB and rate are coming from GDS in XML.
> I have a java object created with list first and displays and trying to
> update as soon as I got XML response.
>
> XML response is quite slow. ( you know there is nothing I can do).
> I can wait XML and display all together. but I'm just seeking a way to
> display list of hotel first with some animation indicating
> rate is being updated and display rate when it's available.
>
> is that make sense now?
>[/color]

Yes, much.

Okay, there really isn't a good way that I know of (cross-browser) to do
this. If you're using IE only (intranet application) let me know,
because you have more options. Generally speaking, once the page is
written, the server knows nothing else about it. It can't refresh the
browser, because the connection is over. COM and ActiveX are exceptions,
but are IE only (AFAIK).

Anyway, the way I would handle this is with an "invisible" iframe
(styled to hidden or 1px by 1px the same background color as the main
page). I would have the iframe wait for the XML, then when it is
received, update the encompassing page. This doesn't require a refresh,
just DHTML.
That still requires NN6+/IE5+ and other browsers that support
iframes/DHTML, but it's better than IE only. Last I checked at my site,
95% of my viewers had browsers that were IE5+ or compatible (opera can
spoof this so be careful).

Do your target users have updated browsers? Do they have permissions to
update their browsers if they need to (i.e. people at schools and
libraries do not.)?

I'm sure there are other ways to handle this, such as applets, COM,
ActiveX, etc, but all require knowing quite a bit about your users'
browsers. For example, using an applet is a bad idea if your users
access the site from public facilities, since they don't have permission
to install an updated JVM should they need to.

--
~kaeli~
A plateau is a high form of flattery.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#9: Jul 20 '05

re: force to refresh browser


do you have any iframe sample I can look?
or please direct me to web site I can get some info from.
Thanks again.

-Kev


"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a2550811825f983989989@nntp.lucent.com...[color=blue]
> In article <bpg1ei$2j5i$1@msunews.cl.msu.edu>, no@spam.com enlightened
> us with...[color=green]
> > I did not explained in detail so I can avoid some confusions.
> > But I guess it did more harm than good.
> >
> > Hotel list are coming from our DB and rate are coming from GDS in XML.
> > I have a java object created with list first and displays and trying to
> > update as soon as I got XML response.
> >
> > XML response is quite slow. ( you know there is nothing I can do).
> > I can wait XML and display all together. but I'm just seeking a way to
> > display list of hotel first with some animation indicating
> > rate is being updated and display rate when it's available.
> >
> > is that make sense now?
> >[/color]
>
> Yes, much.
>
> Okay, there really isn't a good way that I know of (cross-browser) to do
> this. If you're using IE only (intranet application) let me know,
> because you have more options. Generally speaking, once the page is
> written, the server knows nothing else about it. It can't refresh the
> browser, because the connection is over. COM and ActiveX are exceptions,
> but are IE only (AFAIK).
>
> Anyway, the way I would handle this is with an "invisible" iframe
> (styled to hidden or 1px by 1px the same background color as the main
> page). I would have the iframe wait for the XML, then when it is
> received, update the encompassing page. This doesn't require a refresh,
> just DHTML.
> That still requires NN6+/IE5+ and other browsers that support
> iframes/DHTML, but it's better than IE only. Last I checked at my site,
> 95% of my viewers had browsers that were IE5+ or compatible (opera can
> spoof this so be careful).
>
> Do your target users have updated browsers? Do they have permissions to
> update their browsers if they need to (i.e. people at schools and
> libraries do not.)?
>
> I'm sure there are other ways to handle this, such as applets, COM,
> ActiveX, etc, but all require knowing quite a bit about your users'
> browsers. For example, using an applet is a bad idea if your users
> access the site from public facilities, since they don't have permission
> to install an updated JVM should they need to.
>
> --
> ~kaeli~
> A plateau is a high form of flattery.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


kaeli
Guest
 
Posts: n/a
#10: Jul 20 '05

re: force to refresh browser


In article <bpghd4$31ij$1@msunews.cl.msu.edu>, no@spam.com enlightened
us with...[color=blue]
> do you have any iframe sample I can look?
> or please direct me to web site I can get some info from.
> Thanks again.
>[/color]

Tested in NN7.1 and IE6.0 successfully.

test1.htm
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>This is a test page with an iframe that fills in the form below.</p>
<form name="form1" method="post" action="">
<p>item 1:&nbsp;&nbsp;
<input name="item1" type="text" id="item1">
</p>
<p>item 2:&nbsp;&nbsp;
<input name="item2" type="text" id="item2">
</p>
<p>item 3:&nbsp;&nbsp;
<input name="item3" type="text" id="item3">
</p>
</form>
<iframe height="1px" width="1px" src="test2.htm" style="top:-
50;position:absolute;"></iframe>
</body>
</html>


test2.htm
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
This is the contents of the iframe for test1.html
<script type="text/javascript">
top.document.form1.item1.value="hi there";
top.document.form1.item2.value="this is from an iframe";
top.document.form1.item3.value="boo!";

</script>
</body>
</html>

--
~kaeli~
Dijon vu - the same mustard as before.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#11: Jul 20 '05

re: force to refresh browser


Thanks, Kaeli,

I see how iframe works.
However, I do not understand how ifram helps my situation.

Do I constantly refresh test1.htm?

-kev

"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a25916488ff1e3e98998e@nntp.lucent.com...[color=blue]
> In article <bpghd4$31ij$1@msunews.cl.msu.edu>, no@spam.com enlightened
> us with...[color=green]
> > do you have any iframe sample I can look?
> > or please direct me to web site I can get some info from.
> > Thanks again.
> >[/color]
>
> Tested in NN7.1 and IE6.0 successfully.
>
> test1.htm
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body>
> <p>This is a test page with an iframe that fills in the form below.</p>
> <form name="form1" method="post" action="">
> <p>item 1:&nbsp;&nbsp;
> <input name="item1" type="text" id="item1">
> </p>
> <p>item 2:&nbsp;&nbsp;
> <input name="item2" type="text" id="item2">
> </p>
> <p>item 3:&nbsp;&nbsp;
> <input name="item3" type="text" id="item3">
> </p>
> </form>
> <iframe height="1px" width="1px" src="test2.htm" style="top:-
> 50;position:absolute;"></iframe>
> </body>
> </html>
>
>
> test2.htm
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body>
> This is the contents of the iframe for test1.html
> <script type="text/javascript">
> top.document.form1.item1.value="hi there";
> top.document.form1.item2.value="this is from an iframe";
> top.document.form1.item3.value="boo!";
>
> </script>
> </body>
> </html>
>
> --
> ~kaeli~
> Dijon vu - the same mustard as before.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


Jay
Guest
 
Posts: n/a
#12: Jul 20 '05

re: force to refresh browser


Anyway, the way I would handle this is with an "invisible" iframe
(styled to hidden or 1px by 1px the same background color as the main
page). I would have the iframe wait for the XML, then when it is
received, update the encompassing page. This doesn't require a refresh,
just DHTML.


"update the encompassing page" I don't know how to do that..

Thanks.





"Jay" <no@spam.com> wrote in message
news:bpihst$1spb$1@msunews.cl.msu.edu...[color=blue]
> Thanks, Kaeli,
>
> I see how iframe works.
> However, I do not understand how ifram helps my situation.
>
> Do I constantly refresh test1.htm?
>
> -kev
>
> "kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
> news:MPG.1a25916488ff1e3e98998e@nntp.lucent.com...[color=green]
> > In article <bpghd4$31ij$1@msunews.cl.msu.edu>, no@spam.com enlightened
> > us with...[color=darkred]
> > > do you have any iframe sample I can look?
> > > or please direct me to web site I can get some info from.
> > > Thanks again.
> > >[/color]
> >
> > Tested in NN7.1 and IE6.0 successfully.
> >
> > test1.htm
> > <html>
> > <head>
> > <title>Untitled Document</title>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> > </head>
> >
> > <body>
> > <p>This is a test page with an iframe that fills in the form below.</p>
> > <form name="form1" method="post" action="">
> > <p>item 1:&nbsp;&nbsp;
> > <input name="item1" type="text" id="item1">
> > </p>
> > <p>item 2:&nbsp;&nbsp;
> > <input name="item2" type="text" id="item2">
> > </p>
> > <p>item 3:&nbsp;&nbsp;
> > <input name="item3" type="text" id="item3">
> > </p>
> > </form>
> > <iframe height="1px" width="1px" src="test2.htm" style="top:-
> > 50;position:absolute;"></iframe>
> > </body>
> > </html>
> >
> >
> > test2.htm
> > <html>
> > <head>
> > <title>Untitled Document</title>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> > </head>
> >
> > <body>
> > This is the contents of the iframe for test1.html
> > <script type="text/javascript">
> > top.document.form1.item1.value="hi there";
> > top.document.form1.item2.value="this is from an iframe";
> > top.document.form1.item3.value="boo!";
> >
> > </script>
> > </body>
> > </html>
> >
> > --
> > ~kaeli~
> > Dijon vu - the same mustard as before.
> > http://www.ipwebdesign.net/wildAtHeart
> > http://www.ipwebdesign.net/kaelisSpace
> >[/color]
>
>[/color]


kaeli
Guest
 
Posts: n/a
#13: Jul 20 '05

re: force to refresh browser


In article <bpiijm$1tih$1@msunews.cl.msu.edu>, no@spam.com enlightened
us with...[color=blue]
> Anyway, the way I would handle this is with an "invisible" iframe
> (styled to hidden or 1px by 1px the same background color as the main
> page). I would have the iframe wait for the XML, then when it is
> received, update the encompassing page. This doesn't require a refresh,
> just DHTML.
>
>
> "update the encompassing page" I don't know how to do that..
>[/color]

The pages I gave you show that. test2 updates test1. I used a form for
ease and quickness, but you could do any block-level element.

What you do is have the query / xml run in what was my test2.htm. When
it loads, the xml is done. When it loads, have the script write to what
was my test1.htm.


--
~kaeli~
The man who fell into an upholstery machine is fully
recovered.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#14: Jul 20 '05

re: force to refresh browser


then Until test2 is fully updated user is not seeing test1?

Well, my task is while user watching test1.
updates test2 and when update test2 is done refresh test1.
so user can see updated info.

is user has to wait test2 is updated and while doing updating, user don't
see any info.
It is kinda same as before.





"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a2699564a370030989996@nntp.lucent.com...[color=blue]
> In article <bpiijm$1tih$1@msunews.cl.msu.edu>, no@spam.com enlightened
> us with...[color=green]
> > Anyway, the way I would handle this is with an "invisible" iframe
> > (styled to hidden or 1px by 1px the same background color as the main
> > page). I would have the iframe wait for the XML, then when it is
> > received, update the encompassing page. This doesn't require a refresh,
> > just DHTML.
> >
> >
> > "update the encompassing page" I don't know how to do that..
> >[/color]
>
> The pages I gave you show that. test2 updates test1. I used a form for
> ease and quickness, but you could do any block-level element.
>
> What you do is have the query / xml run in what was my test2.htm. When
> it loads, the xml is done. When it loads, have the script write to what
> was my test1.htm.
>
>
> --
> ~kaeli~
> The man who fell into an upholstery machine is fully
> recovered.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


kaeli
Guest
 
Posts: n/a
#15: Jul 20 '05

re: force to refresh browser


In article <bpinhb$21vg$1@msunews.cl.msu.edu>, no@spam.com enlightened
us with...[color=blue]
> then Until test2 is fully updated user is not seeing test1?
>[/color]

No, they see it.

That's the point of the iframe.

--
~kaeli~
Murphy's Law #3020: Quality assurance doesn't.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#16: Jul 20 '05

re: force to refresh browser


I tried with test1 and test2.
What I did was while I'm watching test1.htm.

modify values in test2 and save.
test1.htm.values in text box is not changed.
Unless I refresh test.htm.

Could I force to refresh test1.htm from test2?
Thanks alot.





"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a26a111a7090034989998@nntp.lucent.com...[color=blue]
> In article <bpinhb$21vg$1@msunews.cl.msu.edu>, no@spam.com enlightened
> us with...[color=green]
> > then Until test2 is fully updated user is not seeing test1?
> >[/color]
>
> No, they see it.
>
> That's the point of the iframe.
>
> --
> ~kaeli~
> Murphy's Law #3020: Quality assurance doesn't.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


kaeli
Guest
 
Posts: n/a
#17: Jul 20 '05

re: force to refresh browser


In article <bpirep$25p8$1@msunews.cl.msu.edu>, no@spam.com enlightened
us with...[color=blue]
> I tried with test1 and test2.
> What I did was while I'm watching test1.htm.
>
> modify values in test2 and save.[/color]
[color=blue]
> test1.htm.values in text box is not changed.
> Unless I refresh test.htm.
>
> Could I force to refresh test1.htm from test2?[/color]

Yes, but you're doing someting wrong if the write didn't show in test1.
Test2 is dynamic in practice - the values are assumed to be gotten from
XML or some other server-side language. The hardcoded values are for
testing only, to show you it could be done. You'd need to refresh only
if you changed hardcoded values (hardcoded values would defeat the
entire purpose of this exercise). When you make it dynamic, you don't
have to refresh.

I don't use xml or I'd give you an example.
I can give you an example with ASP or JSP...?

--
~kaeli~
You feel stuck with your debt if you can't budge it.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#18: Jul 20 '05

re: force to refresh browser


JSP would be great.
Thanks.


"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a26b2527913287a989999@nntp.lucent.com...[color=blue]
> In article <bpirep$25p8$1@msunews.cl.msu.edu>, no@spam.com enlightened
> us with...[color=green]
> > I tried with test1 and test2.
> > What I did was while I'm watching test1.htm.
> >
> > modify values in test2 and save.[/color]
>[color=green]
> > test1.htm.values in text box is not changed.
> > Unless I refresh test.htm.
> >
> > Could I force to refresh test1.htm from test2?[/color]
>
> Yes, but you're doing someting wrong if the write didn't show in test1.
> Test2 is dynamic in practice - the values are assumed to be gotten from
> XML or some other server-side language. The hardcoded values are for
> testing only, to show you it could be done. You'd need to refresh only
> if you changed hardcoded values (hardcoded values would defeat the
> entire purpose of this exercise). When you make it dynamic, you don't
> have to refresh.
>
> I don't use xml or I'd give you an example.
> I can give you an example with ASP or JSP...?
>
> --
> ~kaeli~
> You feel stuck with your debt if you can't budge it.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


kaeli
Guest
 
Posts: n/a
#19: Jul 20 '05

re: force to refresh browser


In article <bpitf3$27ic$1@msunews.cl.msu.edu>, no@spam.com enlightened
us with...[color=blue]
> JSP would be great.
> Thanks.
>[/color]

Okay, this is tested successfully in NN6+ only.


test1.jsp has a table with just a header.
test2.jsp queries a DB, then writes the results to the table in
test1.jsp.

When the user brings up test1, they see only the table headers until the
query from test2 is completed. When the query is done, the page loads
and fills in test1's table.

test1.jsp
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>This is a test page with an iframe that fills in the table below.</p>
<table width="75%" border="1" cellspacing="1" cellpadding="5">
<tbody id="cTbl">
<tr>
<td width="10%" nowrap>Customer Id</td>
<td width="90%" nowrap>Customer Name</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<iframe height="1px" width="1px" src="test2.jsp" style="top:-
50;position:absolute;"></iframe>
</body>
</html>


test2.jsp
<%@ page import="OPS.*" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
This is the contents of the iframe for test1.jsp
<%
String q;
String userName="";
String psswd="";
ResultSet rs;
int x = 0; // keep row count
// connect to the database
OPS_dbInteract opsConn = new OPS_dbInteract();
opsConn.connect();
q = "select unique customerName, UPPER(customerName) as CN, customerId
" +
"from customerTbl where customerName like 'A%' "+
"order by CN";
rs = opsConn.queryDB(q);
// for each customer, fill table in test1.jsp
while (rs != null && rs.next())
{
x++; //row count
%>
<script type="text/javascript">
TR = document.createElement("TR");
TD = document.createElement("TD");
txt = document.createTextNode("<%= rs.getLong("customerId") %>");
TD.appendChild(txt);
TR.appendChild(TD);
TD = document.createElement("TD");
txt = document.createTextNode("<%= rs.getString("customerName")
%>");
TD.appendChild(txt);
TR.appendChild(TD);
top.document.getElementById("cTbl").appendChild(TR );
</script>
<%
}
opsConn.close();
%>

</body>
</html>




--
~kaeli~
Does the name Pavlov ring a bell?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jay
Guest
 
Posts: n/a
#20: Jul 20 '05

re: force to refresh browser


Thanks, You are a life saver.
I will let you know after testing.

-kev

"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a26e24fcdf7bab198999a@nntp.lucent.com...[color=blue]
> In article <bpitf3$27ic$1@msunews.cl.msu.edu>, no@spam.com enlightened
> us with...[color=green]
> > JSP would be great.
> > Thanks.
> >[/color]
>
> Okay, this is tested successfully in NN6+ only.
>
>
> test1.jsp has a table with just a header.
> test2.jsp queries a DB, then writes the results to the table in
> test1.jsp.
>
> When the user brings up test1, they see only the table headers until the
> query from test2 is completed. When the query is done, the page loads
> and fills in test1's table.
>
> test1.jsp
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body>
> <p>This is a test page with an iframe that fills in the table below.</p>
> <table width="75%" border="1" cellspacing="1" cellpadding="5">
> <tbody id="cTbl">
> <tr>
> <td width="10%" nowrap>Customer Id</td>
> <td width="90%" nowrap>Customer Name</td>
> </tr>
> </tbody>
> </table>
> <p>&nbsp;</p>
> <iframe height="1px" width="1px" src="test2.jsp" style="top:-
> 50;position:absolute;"></iframe>
> </body>
> </html>
>
>
> test2.jsp
> <%@ page import="OPS.*" %>
> <%@ page import="java.sql.*" %>
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body>
> This is the contents of the iframe for test1.jsp
> <%
> String q;
> String userName="";
> String psswd="";
> ResultSet rs;
> int x = 0; // keep row count
> // connect to the database
> OPS_dbInteract opsConn = new OPS_dbInteract();
> opsConn.connect();
> q = "select unique customerName, UPPER(customerName) as CN, customerId
> " +
> "from customerTbl where customerName like 'A%' "+
> "order by CN";
> rs = opsConn.queryDB(q);
> // for each customer, fill table in test1.jsp
> while (rs != null && rs.next())
> {
> x++; //row count
> %>
> <script type="text/javascript">
> TR = document.createElement("TR");
> TD = document.createElement("TD");
> txt = document.createTextNode("<%= rs.getLong("customerId") %>");
> TD.appendChild(txt);
> TR.appendChild(TD);
> TD = document.createElement("TD");
> txt = document.createTextNode("<%= rs.getString("customerName")
> %>");
> TD.appendChild(txt);
> TR.appendChild(TD);
> top.document.getElementById("cTbl").appendChild(TR );
> </script>
> <%
> }
> opsConn.close();
> %>
>
> </body>
> </html>
>
>
>
>
> --
> ~kaeli~
> Does the name Pavlov ring a bell?
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>[/color]


Closed Thread