Time stamp servlet 1.1

    It is a Java servlet lets you request server's time. Servlet simply returns server's time in milliseconds. If you are providing a parameter callback than server returns data in JSONP format - so you will be able to use server's time in your JavaScript applications.

How to use it:

a) copy timestampPackage.jar into your WEB-INF/lib directory.

b) define a servlet in your web.xml file:


define a mapping:


Servlet accepts the following parameters:

callback - Optional parameter. Describes a name for your JavaScript callback

    The following example illustrates the usage. JavaScript function f describes our callback.

<script language="JavaScript">

function f(info)
  alert("Server's time is: "+info);


var e = document.createElement("script");
e.src = 'http://your_server/servlet/time?callback=f';


    For downloading:  timestampPackage.jar   

  © Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: