how to show server time clock in client

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BibhuAshish
    New Member
    • Oct 2007
    • 34

    how to show server time clock in client

    Hi,
    I am using struts 2.
    I need to have a clock ticking every second in my webpage to show server time. I do not want to refresh my whole page every second and i do not want to use applet.

    Now how can i display time in my webpage?

    I wrote jsp code like the following:::::

    [code=java]
    <%
    java.util.Date d= new java.util.Date( );
    DateFormat df = DateFormat.getD ateInstance();
    out.println(df. format(d));
    %>
    [/code]

    But it is not refreshing.
    I want that it should not refresh my whole page but it should refresh the time only.
  • samido
    New Member
    • Oct 2007
    • 52

    #2
    Hi, so what you mean is you want outomatically the time respondr from the server every second and shows that to you client(web page), as far as I am concerned there is no responds from the server without requests and this is what you need in other way round, so why dont you create some machanism with two clocks where by the other one is the master from your server and the other one is the temp that shows on your client, you syncronises the two and when your page refreshes all it does is to check if your temp and the server clocks are still the same and the temp have to be updated if not, this might not be that 100% accurate but most people did it like that and it is reliable

    Kind regards: Sam Rabophala

    Comment

    Working...