Question

JSP page refresh

Asked by: cofactor

i am trying to learn page refresh at regular intervals(say 5 sec).

but i am not getting it working.

though the page is refreshing but the problem of FLICKERING is remaing.
my status bar is showing that flickering... thats not good.


here is my code i which tried.

refreshTest.jsp
==================

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
 <FRAMESET ROWS="50,50">
  <FRAME name="main" src="top.jsp" id="bottom">
  <FRAME name="hidden" src="bottom.jsp" >
 </FRAMESET>



bottom.jsp
==========
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>

<html>
<head>
<script LANGUAGE="JavaScript">
function refreshFrame() {

parent.frames["main"].location.href='bottom.jsp'
}
</script>

<script type="text/javascript">
function refresh()
{
//while(true)
//{
setTimeout("refreshFrame()",5000)
      //alert("hi");
//Sleep(5000);
//}
}
</script>

</head>



<body onload="refresh()">

GRRR...
<%
java.util.Date d=new java.util.Date();
out.println(d);
%>



</body>
</html>


top.jsp
========
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>

HELLO












problem withn the above code.

1) HELLO is not printed immediately.
2)FLICKERING is there. status bar is filling very quickly. odd looking ....it seems as silimilar if i would have used html-refresh.



question :
==========

How can i remove flickering ?
should i use iframe  instead of ordinary frame to remove flickering ?

i am not interested to use AJAX,APPlet because those things i have learnt already.

i am stuck with  hidden frames and  page refreshing in JSP without page flickering.


can u provide me a better example ?

regards


This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-10-26 at 02:56:13ID21608064
Tags

jsp

,

refresh

,

page

Topic

Java Server Pages (JSP)

Participating Experts
1
Points
45
Comments
38

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Refreshing the Applet
    I am writing an applet for a game, and I'm changing the background color of buttons throughout the game (I'm using them as my game squares). But, when I change the background color, the screen or button doesn't refresh the colors until the mouse passes over that button. How...
  2. out.println("\n"); does not work in JSP
    iam tryng to print new lines using jsp. out.println("\n"); this is not working ..how to do?
  3. refresh a page using jsp
    Is it possible to refresh a page using jsp?, or embed a html refresh within jsp?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: TimYatesPosted on 2005-10-26 at 03:03:40ID: 15160990

How about:

bottom.jsp
-------------

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>

<html>
<head>
    <meta http-equiv="refresh" content="5">
</head>
<body onload="">
GRRR...
<%
java.util.Date d=new java.util.Date();
out.println(d);
%>
</body>
</html>

 

by: cofactorPosted on 2005-10-26 at 03:48:05ID: 15161216

ok. i replaced my bottom.jsp with ur bottom.jsp

problem:
1) page is flickering.
2) hello is not replaced by the date.

 

by: cofactorPosted on 2005-10-26 at 03:49:18ID: 15161219

look at the last comment

http://forum.java.sun.com/thread.jspa?forumID=45&threadID=204158

i tried to do same like that. but thats not working

 

by: TimYatesPosted on 2005-10-26 at 03:58:30ID: 15161254

Ok, as a quick test, I did this:

main.html:

<FRAMESET ROWS="50,50">
  <FRAME name="main" src="top.html" id="bottom">
  <FRAME name="hidden" src="bottom.html" >
</FRAMESET>

top.html:

<html>
  <body>
    HELLO
  </body>
</html>

bottom.html:

<html>
<head>
<script LANGUAGE="JavaScript">
  function refreshFrame()
  {
    parent.frames["main"].location.href='bottom.html'
  }

  function refresh()
  {
    setTimeout("refreshFrame()",5000)
  }
</script>
</head>
<body onload="refresh()">
  <script language="JavaScript">
    document.write( new Date().toGMTString() ) ;
  </script>
</body>
</html>

And that seems to work ok (on firefox)

Does it not work on your machine?

 

by: TimYatesPosted on 2005-10-26 at 03:59:19ID: 15161256

works on IE too...

 

by: cofactorPosted on 2005-10-26 at 04:12:26ID: 15161319


did you notice the status bar..its flickering ! thats what my concern from the begining.

some ppl say use of iframe may remove that . do u agree ?
how ?

 

by: TimYatesPosted on 2005-10-26 at 04:16:56ID: 15161339

i dont see any flickering...

is this in IE or firefox you see it?

And which version?

 

by: TimYatesPosted on 2005-10-26 at 04:18:12ID: 15161346

Unless...

by "flickering", do you mean you can see the progress bar every 5 seconds?

 

by: cofactorPosted on 2005-10-26 at 04:28:42ID: 15161403

>by "flickering", do you mean you can see the progress bar every 5 >seconds

yes.


i  have seen some sites where this "flickering" does not exist but the pages refreshes. some of them uses  AJAX , some of them  uses  iframe.

i am interested with iframe.

but i am still not able to do it

 

by: cofactorPosted on 2005-10-26 at 04:31:57ID: 15161416

>is this in IE or firefox you see it?
firefox.


i have IE,Firefox,opera,netscape,mozila  browser installed in my PC.

 

by: cofactorPosted on 2005-10-26 at 05:53:11ID: 15161992

hi Tim r u there ?

can u block that flickering ?

is there any way ? if it can not be done this way  then whats the proper way ?

 

by: TimYatesPosted on 2005-10-26 at 05:54:46ID: 15162010

I can't think of a way to stop it...

Even if I get an iframe to reload its contents, I get the progress bar...

 

by: cofactorPosted on 2005-10-26 at 06:06:46ID: 15162093

ok...ummm....
so, to get the page refresh i should use only

<meta http-equiv="refresh" content="5">

to my page where i  want the updation. is not it ? there is no frames and all these stuff....

but this will keep on refreshing ......... how do u stop refrshing say after 30 secs ?

 

by: TimYatesPosted on 2005-10-26 at 06:12:06ID: 15162123

>> so, to get the page refresh i should use only

No, it will give you the same result as javascript (see my html pages I posted)

still flickering :-(

To get it to stop after 30 seconds, you'd have to have another frame, which had a javascript counter  in it.

Decrement the counter each time the page is loaded, and stop calling the refreshing timer if the counter is 0

Could get a bit messy...  but I can't think of a cleaner way off hand :-(

Tim

 

by: cofactorPosted on 2005-10-26 at 06:23:49ID: 15162202

its really messy.

just go to

http://www.sidestep.com/air/

enter  LON  to AMS

then" search"

now see how the pages are getting refreshed. excellent ...is not it ? no flickering.

i wanted to do something like that.

from the view source, i see they are probabily using AJAX. well, but some sites dont use reall AJAX ( i dont remeber the example site )  but gets  the same output.

i  like that.

html-refresh can not provide that kind of nice  page refreshing.

 

by: TimYatesPosted on 2005-10-26 at 06:34:42ID: 15162301

Yeah, that page has:

    new Ajax.Updater

lines in it, so they are using AJAX to query the database, then using javascript to update the webpage as the results come back

like:

    <div id="results"></div>

    <script language="javascript">
        getElementById( "results" ).innerHTML += "<br>Woo!" ;
        getElementById( "results" ).innerHTML += "<br>Cool!" ;
    </script>

(replacing "woo" and "cool" with real data as it comes back from the server of course) ;-)

Tim

 

by: cofactorPosted on 2005-10-26 at 22:42:03ID: 15168266

is this forum working now ?testing

 

by: cofactorPosted on 2005-10-26 at 22:42:49ID: 15168271

ahh...its working.

ok..fine.
here i am back..



You  know, the big problem(i dont like) is the XML parsing in the client side by javascript in AJAX. server side returns a XML response and the clent side javascript  parse that xml and update the DOM as similar you have given an example above.


may be i am not  comfortable with the XML parsing with the javascript in the client side and update the HTML DOM.

can you tell me a tutorial for that ? i saw w3schools  any other good  tutorial  link .... ?



As you are a classic programmer, so what do you suggest ?  AJAX would be a good solution for JSP page refreshing  ? i want to get  my page refreshing as similar as to that site i have referred.



Now, coming back to ur response.

>>(replacing "woo" and "cool" with real data as it comes back from the server of course) ;-)

but your "woo" and "cool" are not XML data ! its a text data...server can not return text data in AJAX. it returns XML response and javacript parse that XML.

did you just show this example for simplicity without server's XML response?? or it could be a real situation where server can return plain text  data ?






 

by: cofactorPosted on 2005-10-26 at 22:47:10ID: 15168283

and also....if the server provides 1 XML in every 10  seconds for 50 seconds...  how do i append these 50/10=5 XML in my web page ? div tag ? but how ?

 

by: TimYatesPosted on 2005-10-26 at 23:54:09ID: 15168506

Have you had a look at DWR?

It allows you to call java methods (which can return String) on the server from javascript on the client:

http://getahead.ltd.uk/dwr/index

You basically, write java classes, install a servlet, and DWR generates the javascript you need to call those classes

 

by: cofactorPosted on 2005-10-27 at 00:32:40ID: 15168653

>Have you had a look at DWR?
yes. i looked that. but could not understood that.

yea, i read their documentation ..but still i could not  .

>It allows you to call java methods (which can return String) on the server from javascript on the client:
>http://getahead.ltd.uk/dwr/index
>You basically, write java classes, install a servlet, and DWR generates the javascript you need to call those classes

can you please provide me an example using  DWR how do i get a similar feature  like the sites i have referred.

i think you have understood the problem. you take a very simple example  to show that kind of feature.

i believe Ajax is god but its very diificult to update the DOM.

i want to get a similar feature as the site i have mentioned.
can you show me  a small example on that ?

 

by: TimYatesPosted on 2005-10-27 at 01:44:52ID: 15168933

Ok, here's a quick DWR example...

Set up DWR as it explains in the installation guide.

Then, write a bean like this:

package ajaxtest ;

public class ServerTimeBean
{
    public ServerTimeBean() {}
    public String getTime() { return new Date().toString() ; }
}

compile it, and copy it to /WEB-INF/classes/ajaxtest

then, write WEB-INF/dwr.xml like this:

<!DOCTYPE dwr PUBLIC
    "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
    "http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
  <allow>
    <create creator="new" javascript="ServerTimeBean">
      <param name="class" value="ajaxtest.ServerTimeBean"/>
    </create>
  </allow>
</dwr>

then, write your frame like this:

<%@ page contentType="text/html; charset=UTF-8" %>
<html>
  <head>
    <title>DWR Test</title>
    <script type='text/javascript' src='/dwr/interface/ServerTimeBean.js'></script>
    <script type='text/javascript' src='/dwr/engine.js'></script>
    <script type='text/javascript' src='/dwr/util.js'></script>

    <script type='text/javascript'>
        function refreshFrame()
        {
            DWRUtil.setValue( 'd1', ServerTimeBean.getTime() ) ;
            setTimeout("refreshFrame()",5000) ;
        }
    </script>
  </head>

  <body bgcolor="#ffffff" onload="refreshFrame()">
      <span id='d1'></span>
  </body>

</html>

That *should* work...

I haven't tested it, but will do so if you get any problems with it :-)

Tim

 

by: cofactorPosted on 2005-10-27 at 02:07:45ID: 15169011

Tim...i saw your solution (will go for testing shortly).its very promising. you are refrsing the System time every 5 secs interval in this code

<body bgcolor="#ffffff" onload="refreshFrame()">
      <span id='d1'></span>
  </body>


but you know, my server will return XML data. say after 5 secs in returned 5 XML then there would be 5  tables. say after 10 secs my server will return 10 XML(total) so 10 tables will be displayed.

if i do as above then only one table would be displayed...is not it ?

but look at the site i have referred which keeps on adding XML data into tables and showing more results.

but the code here

<body bgcolor="#ffffff" onload="refreshFrame()">
      <span id='d1'></span>
  </body>

can show only one value.

 

by: TimYatesPosted on 2005-10-27 at 02:12:06ID: 15169032

I was just giving you a simple example of how DWR can be used to fetch the time as a String asynchronously from the server...not reproducing the website you linked to...

I think you would need to implement a few methods in a java class:

startProcessing( parameters )

get Progress()

getLatestResults()

so when a user posts their search parameters, you call startProcessing, which starts the server looking for data

every X seconds, you can call getProgress to see how far along you are, and getLatestResults to return you the new objects found since the last time it was called

Then, you should be able to append these new results to the existing ones in the div...

Tim

 

by: cofactorPosted on 2005-10-27 at 03:17:59ID: 15169249

>you should be able to append these new results to the existing ones in >the div...

but how do i add 5 tables containing different results ?


      div id="results"></div>


    <script language="javascript">
        getElementById( "results" ).innerHTML += "<table border="0"
cellpadding="0" cellspacing="0" width="100%">          <tbody><tr>  <td id="resultCardTopLine"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="txt" align="left" valign="middle"><img src="/images/buttons/arrow_breadcrumb.gif" align="middle" height="7" width="9">&nbsp;<span class="not_sorted"><a href="/air/select_details.do?uniqueId=1011138"><b>KLM Royal Dutch Airlines</b> (Flight Details)</a></span></td>            <td class="txt-label price" align="right" valign="middle" width="95"><span id="resultCardPrice" style="font-size: 14px;"><span class="not_sorted">$183.00</span></span></td></tr></tbody></table></td>          </tr>        </tbody></table>          </td>        </tr>      <tr>        <td style="padding: 10px;"><table border="0" cellpadding="0" cellspacing="0" width="100%">          <tbody><tr>            <td class="txt-small" align="left" valign="top" width="50">Depart:</td>            <td valign="top"><table border="0" cellpadding="0" cellspacing="0" width="320">              <tbody><tr style="background-image: url(/images/bg_dotted_border_btm_11.gif);">                <td class="txt-small"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;"><b>Amsterdam, </b>&nbsp;(<span title="Amsterdam">AMS</span>)</span></td>                <td class="txt-small" align="right" valign="top" width="30"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;">11/17</span></td>                <td class="txt-small" style="padding-left: 10px;" align="right" valign="top" width="50"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;"><span class="not_sorted"><b>10:30</b>&nbsp;am</span></span></td>                <td class="txt-small" style="padding-left: 15px;" bgcolor="#ffffff" width="50"><div style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;"><span class="not_sorted"><b>0</b> Stops</span></div></td>              </tr>              <tr style="background-image: url(/images/bg_dotted_border_btm_11.gif);">                <td class="txt-small"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;">to <span style=""><b>London, </b>&nbsp;(<span title="London Heathrow Apt">LHR</span>)</span></span></td>                <td class="txt-small" align="right" valign="top" width="30">&nbsp;</td>                <td class="txt-small" style="padding-left: 10px;" align="right" valign="top" width="50"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;"><b>10:50</b>&nbsp;am</span></td>                <td class="txt-small" width="65"><div style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;">&nbsp;</div></td>  </tr>            </tbody></table>            </td>            <td rowspan="1" align="center" valign="top" width="16%"><img src="/images/logos/airlines/kl.gif" onerror="this.src='/images/logos/airlines/default.gif'" border="0" height="20" vspace="0" width="80"><a href="/air/select_transfer.do;jsessionid=E570FED6E2A90E0DFD03B41539CBE7F1.p105?uniqueId=1011138&amp;page=result" target="airTransferWin"></a>            </td>          </tr>    <tr><td class="txt-small" style="padding-top: 7px;" align="left" valign="top" width="50">Return:</td><td style="padding-top: 7px;" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="320">  <tbody><tr style="background-image: url(/images/bg_dotted_border_btm_11.gif);"><td class="txt-small"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;"><b>London,  </b>&nbsp;(<span title="London Heathrow Apt">LHR</span>)</span></td><td class="txt-small" align="right" valign="top" width="30"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;">11/22</span></td><td class="txt-small" style="padding-left: 10px;" align="right" valign="top" width="50"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;"><b>10:00</b>&nbsp;am</span></td><td class="txt-small" style="padding-left: 15px;" bgcolor="#ffffff" width="50"><div style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;"><span class="not_sorted"><b>0</b> Stops</span></div></td>  </tr>  <tr style="background-image: url(/images/bg_dotted_border_btm_11.gif);"><td class="txt-small"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;">to <span style=""><b>Amsterdam,  </b>&nbsp;(<span title="Amsterdam">AMS</span>)</span></span></td><td class="txt-small" align="right" valign="top" width="30">&nbsp;</td><td class="txt-small" style="padding-left: 10px;" align="right" valign="top" width="50"><span style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;"><b>12:25</b>&nbsp;pm</span></td><td class="txt-small" width="65"><div style="background-color: rgb(255, 255, 255); padding-left: 1px; padding-right: 1px;">&nbsp;</div></td>  </tr></tbody></table></td><td style="padding-top: 7px;" align="center" valign="bottom" width="16%"><a href="/air/select_transfer.do;jsessionid=E570FED6E2A90E0DFD03B41539CBE7F1.p105?uniqueId=1011138&amp;page=result" target="airTransferWin"><img src="/images/buttons/book_now_arrow.gif" align="bottom" border="0" height="19" vspace="5" width="94"></a></td>  </tr>        </tbody></table>
" ;
 
getElementById( "results" ).innerHTML += "another table like above" ;
getElementById( "results" ).innerHTML += "another table like above" ;
    </script>

 

by: cofactorPosted on 2005-10-27 at 03:19:17ID: 15169255

this way i can not append the data .

 

by: TimYatesPosted on 2005-10-27 at 03:30:47ID: 15169300

      getElementById( "results" ).innerHTML += "<table border="0"

You use double quotes to start the String, then round the "0", which will stop the string, then put a 0 in, then start the string again...

It's javascript errors such as this that stop the above working afaik...

Tim

 

by: cofactorPosted on 2005-10-27 at 03:36:16ID: 15169322

i posted as above just to show how messy this is. because we are mixing JS + HTML+ CSS all these stuff...its horrible inside JS.

probabily, i would better stick with flickering solution. i.e with html meta-refresh/ javascript setTimeout  ...can i  have a stop button on my page to stop refreshing ?
you told "...To get it to stop after 30 seconds, you'd have to have another frame, which had a javascript counter  in it.

Decrement the counter each time the page is loaded, and stop calling the refreshing timer if the counter is 0..."


how  to do it ? any small example?

 

by: cofactorPosted on 2005-10-27 at 03:38:26ID: 15169338

i have read server side push in a orelli book. how about that .

there also i have mix
.............
String htmlCode = "<table><tr><td>.......</td></tr>..................very big table </table>";
out.println(htmlCode);..
out.flush();

 

by: cofactorPosted on 2005-10-27 at 03:58:33ID: 15169429

hi, Tim   r u there ? have u seen
do u have yahoo account ?

http://farechase.yahoo.com/

they are also doing the same thing ...but they are not using AJAX !  there page  does not flicker .

 

by: TimYatesPosted on 2005-10-27 at 05:00:28ID: 15169743

>> ...but they are not using AJAX !

Yes they are...

    this.req=new XMLHttpRequest();

(from http://re2.farechase.yahoo.com/cs/prod/cts-cts_base_p_11211.js)

 

by: cofactorPosted on 2005-10-27 at 21:29:03ID: 15176569

Tim, my biggest concern is i can not display the XML output . the XML has to be  parsed by the JS and then would be displayed in tables . so , if i have 5 different XML . then i have to parse those 5 XML's and then those 5 XML  data would be displayed in 5 tables  as you see in the referred site i mentioned.  this kind of display is a very  tough thing.


Howeve, another solution i have found  in the net which claims

".......Split your window frame in 2 parts - one part will be displaying
the current page and another part should have a hidden page. Every
time you need to refresh the page, submit the hidden page data and use
the hidden page data fetched from server to show new content. that is
use hidden page for communication with server.............."


do u think this can remove flickering ?


if you think so, please provide me an example to test. i would prefer this because  i can then use  java beans in my JSP page.  and i shall parse XML data and store the data into the bean in the server side.  and display those data in my JSP hidden page.


i like this method.   i tested but  could not remove the flickering....may be my coding was wrong . can you try ? can you tell if i follow the above comments , it would remove flickering ?

 

by: TimYatesPosted on 2005-10-28 at 01:07:20ID: 15177168

Basically you have three options:

1)  Use a hidden/second frame, and load data this way.  This will cause the progress meter to appear (flicker) as the data is loaded

2)  Use basic AJAX, and parse the XML to generate HTML (no flicker)

3)  Use DWR (or another similar framework).  This will allow you to build html on the server and just display it (see my DWR example) with no flickering

Tim

 

by: cofactorPosted on 2005-10-28 at 03:32:58ID: 15177774

>This will allow you to build html on the server.

problem is here. server could build html...no problem. but if there is html + css + table ete etc....then how much messy it would be.

you know, say i have made a nice looking html table as like above .

server could sent this table by two ways...

1) out.println("a big nice looking table with css");

problem here would be, table would be very big and also have to take care of ESCAPE character.

2)  DWRUtil.setValue( 'd1', ServerTimeBean.getTime() ) ;

so, DWR is sending a server side component here, may we could send a table from the serverSide...same thing.



you know what could have been the best thing ....if we can have a  html table in JSP ...and server would just put the data into it. thats the best option.

but server can not do this . server have to produce tables for as many as XML  there would be. so it has to produce tables ...and producing a NICE looking tables  from  the bean class or out.println() is tedious.

 

by: cofactorPosted on 2005-10-28 at 03:38:47ID: 15177788

i am interested in your   flickering  solution (with frames) in your  reply no 2
could you add one fucntionality there ?

1) refreshing would stop after 50 secs automatically.

2) there would be a stop button but in between 0-50 secs , if one user press the "stop" button , a boolean varible would be made false in the server side and  it would stop refreshing

 

by: cofactorPosted on 2005-11-22 at 20:21:17ID: 15347825

Excellent Rating to you.

i did smething like that. i did not use AJAX or DWR .. it was bit unconvenient to parse the big XML  in the client side.

so, i chose the first solution i.e page refresh....my page refreshes and  the irritating  status bar is shown.

Anyway, i wonder some people says using iframe  this could be managed !  i do  not know how they are managing.

thanks

 

by: TimYatesPosted on 2005-11-23 at 02:07:13ID: 15348745

If you find out how they do it, can you let us know?  

Good luck with it all!  Sorry I couldn't give you the answer you were looking for :-(

Tim

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...