By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,529 Members | 1,860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,529 IT Pros & Developers. It's quick & easy.

force to refresh browser

P: n/a
Jay
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

Jul 20 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
In article <bp**********@msunews.cl.msu.edu>, no@spam.com enlightened us
with...
I'm trying to refresh browser when some new information is available in DB.
is there any way to force to refresh browser?
Thanks.

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

Jul 20 '05 #2

P: n/a
Jay
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" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp**********@msunews.cl.msu.edu>, no@spam.com enlightened us
with...
I'm trying to refresh browser when some new information is available in DB. is there any way to force to refresh browser?
Thanks.

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

Jul 20 '05 #3

P: n/a
In article <bp**********@msunews.cl.msu.edu>, no@spam.com enlightened us
with...
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.


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

Jul 20 '05 #4

P: n/a
Jay
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" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp**********@msunews.cl.msu.edu>, no@spam.com enlightened us
with...
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.


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

Jul 20 '05 #5

P: n/a
In article <bp**********@msunews.cl.msu.edu>, no@spam.com enlightened us
with...
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?


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

Jul 20 '05 #6

P: n/a
Jay
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" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp**********@msunews.cl.msu.edu>, no@spam.com enlightened us
with...
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?


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

Jul 20 '05 #7

P: n/a
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
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?


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

Jul 20 '05 #8

P: n/a
Jay
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" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
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?


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

Jul 20 '05 #9

P: n/a
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
do you have any iframe sample I can look?
or please direct me to web site I can get some info from.
Thanks again.


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

Jul 20 '05 #10

P: n/a
Jay
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" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
do you have any iframe sample I can look?
or please direct me to web site I can get some info from.
Thanks again.


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

Jul 20 '05 #11

P: n/a
Jay
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:bp***********@msunews.cl.msu.edu...
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" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
do you have any iframe sample I can look?
or please direct me to web site I can get some info from.
Thanks again.


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


Jul 20 '05 #12

P: n/a
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
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..


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

Jul 20 '05 #13

P: n/a
Jay
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" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
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..


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

Jul 20 '05 #14

P: n/a
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
then Until test2 is fully updated user is not seeing test1?


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

Jul 20 '05 #15

P: n/a
Jay
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" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
then Until test2 is fully updated user is not seeing test1?


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

Jul 20 '05 #16

P: n/a
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
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?


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

Jul 20 '05 #17

P: n/a
Jay
JSP would be great.
Thanks.
"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
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?


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

Jul 20 '05 #18

P: n/a
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
JSP would be great.
Thanks.


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

Jul 20 '05 #19

P: n/a
Jay
Thanks, You are a life saver.
I will let you know after testing.

-kev

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bp***********@msunews.cl.msu.edu>, no@spam.com enlightened
us with...
JSP would be great.
Thanks.


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

Jul 20 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.