Hi-

Do you mean to say that the time difference is much less than the time
from when you click the mouse, to when page is rendered in browser?

In your code below, since you are using <%=scriptlets%> you are only
going to measure the time that the Java servlet itself takes. This
will not take into account the time for:
- an action servlet to execute and forward to this JSP
- any database access to generate the 'users' collection
- translating the JSP to Java code (first time JSP is called)
- the Java to be compiled to a servlet .class file (first time JSP is called)
- streaming the generated HTML across your network to your browser
- browser to load main.css
- browser to render the page

The best way to trace these is lots of debugging statements at
strategic places in your code.

However, the simple way is to use endTime to store the time that the
JSP is executed. If you are using an Action class, store a Date into
the session or request scope, and then in your JSP page, have
Javascript code that stores a datestamp as well. By comparing these
figures you can get an idea of how long some of these steps take. If
you had a lot of data being displayed you could also get a fourth
javascript function to run in <body onload=> so you could get a
timestamp of how long it takes for the browser to render your page.

Good luck,
-ed

On 3/20/07, puchacz <[EMAIL PROTECTED]> wrote:

Hi

Hi If anybody could tell me, how can I measure the time of displaying some
data on the screen?

<code>


<%@ include file="/WEB-INF/jsp/include.jsp"%>
<[EMAIL PROTECTED] import="bus.TimeHold"%>
<[EMAIL PROTECTED] import="java.util.Date"%>

<html>
<link type="text/css" href="./css/main.css" rel="stylesheet" media="screen">

<head>

<script language="JavaScript" type="text/javascript">
function displayName(){
var myVar = document.getElementById("startTime").value;
var myVary = document.getElementById("endTime").value;
alert("Value is: " + myVar  + "   " + myVary + "   "  + (myVary-myVar));

}
</script>

<%
        java.util.Date begin = new Date();

        long pomocnicza;
        pomocnicza = begin.getTime();

%>


</head>
<body onload="displayName();">

<c:out value="${startTime}" />

<input type="text" value="<%=pomocnicza %>" id="startTime">



<table width="100%">
        <tr>
                <td>

<center>

                <display:table name="users" export="false" id="currentRowObject"
                        requestURI="listOfUsers.do" decorator="view.Wrapper">
                        <display:column property="name" title="Name"  />
                        <display:column property="lastName" title="Last name" />
                        <display:column property="school" title="School"
headerClass="table_head" />
                </display:table>
</center>

                </td>
        </tr>
</table>

<%
        java.util.Date end = new Date();


        pomocnicza2 = end.getTime();


%>

<input type="text" value="<%=pomocnicza2 %>" id="endTime"/>

</body>

</html>

</code>


The thing is that the time which in the "pomocnicza2" is much more smaller
then the time of displaying the page. How to check time after display the
page?
If anybody has any idea, please tell me!!! I sit on this problem for a such
a long time, and nothing :(.

Thnx

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to