elapsed time

my jsp page is refreshing. i want to display the elapsed time in my JSP.how ?
[91 byte] By [variablea] at [2007-10-2 4:48:09]
# 1
Have the servlet take the current time in the begining, add it to the session and have the JSP take it again at the end of its code. Calculate the difference and print it.
CeciNEstPasUnProgrammeura at 2007-7-16 0:52:52 > top of Java-index,Java Essentials,Java Programming...
# 2
Or do it by Javascript: on submission, add a timestamp argument, and parse and display it onLoad, using the client time both times. Much more acurate.
CeciNEstPasUnProgrammeura at 2007-7-16 0:52:52 > top of Java-index,Java Essentials,Java Programming...
# 3
>Have the servlet take the current time in the beginingi dont have servlet. :(can not i do the whole in JSP itself ?
variablea at 2007-7-16 0:52:52 > top of Java-index,Java Essentials,Java Programming...
# 4

>Or do it by Javascript: on submission, add a timestamp argument, and >parse and display it onLoad, using the client time both times. Much more >acurate

my JSP is already sending a timestamp value to stop server cache.

like when i submit my JSP, the url becomes

http://machine:8080/myjsp?timestamp=12345678&some_more_params...

>Or do it by Javascript: on submission, add a timestamp argument, and >parse and display it onLoad, using the client time both times. Much more >acurate

please provide a sample code architecture. not getting your idea.

variablea at 2007-7-16 0:52:52 > top of Java-index,Java Essentials,Java Programming...
# 5

> >Have the servlet take the current time in the

> begining

>

> i dont have servlet. :(

>

> can not i do the whole in JSP itself ?

In case you didn't know, a JSP is a servlet - the JSP container converts your JSP page to a servlet. Just add some Java code to your JSP:

<%-- at the top of the page --%>

<% long startTime = System.currentTimeMillis(); %>

<%-- at the bottom of the page --%>

<% long totalTime = System.currentTimeMillis() - startTime; %>

render time: <%= totalTime %>

jesperdja at 2007-7-16 0:52:52 > top of Java-index,Java Essentials,Java Programming...