I was playing devil's advocate -- since we don't really know the OP's requirement(s), but we do know the OP seemed to really want the client's time. > -----Original Message----- > From: Pid [mailto:p@pidster.com] > Sent: Tuesday, July 11, 2006 6:38 PM > To: Tomcat Users List > Subject: Re: Getting the date/time from the client > > A good devil's advocate question, or was it rhetorical? > > Either way it's got exactly the answer you'd expect, you'll set the date > to whatever Locale the Request returns. Obviously. > > > > > > Tim Lucia wrote: > > Is that really appropriate?? What if I have my Locale set to France, > and my > > clock set to Pacific Standard Time? Then what? (assume I am on the > east > > coast of the USA...) > > > > Tim > > > >> -----Original Message----- > >> From: Vinu Varghese [mailto:vinu@x-minds.org] > >> Sent: Tuesday, July 11, 2006 8:05 AM > >> To: Tomcat Users List > >> Subject: Re: Getting the date/time from the client > >> > >> Thanks Pid, > >> > >> I think that is a good idea > >> Let me try > >> > >> - Regards > >> Vinu > >> > >> Pid wrote: > >>> you can get a Locale from the request, and adjust the time > accordingly. > >>> > >>> Vinu Varghese wrote: > >>> > >>>> but that still sets the server date - yes ? > >>>> > >>>> Pid wrote: > >>>> > >>>>> write a filter that activates for that url, and get the time just > >> before > >>>>> you doFilter. if you need to, you can pass the date obj as an > >> attribute > >>>>> Date date = new Date(); > >>>>> hreq.setAttribute("thisIsTheDate", date); > >>>>> chain.doFilter(hreq, hres); > >>>>> > >>>>> > >>>>> > >>>>> Jon Wingfield wrote: > >>>>> > >>>>> > >>>>>> The HTTP spec (rfc2616) says clients should only send the Date > header > >>>>>> with http messages with body content (POST, PUT) and even then it's > >>>>>> optional. > >>>>>> > >>>>>> Try adding a date string as a parameter on your GET request which > >> your > >>>>>> servlet can then parse from request.getParameter(...). > >>>>>> > >>>>>> One way to do this would be to change your link to a form with a > >> hidden > >>>>>> input field for your date value. Add an onclick/onsubmit javascript > >>>>>> handler to your form button which sets the value of the hidden > field > >> to > >>>>>> the current date in a format that your servlet will understand. > >>>>>> > >>>>>> for example: > >>>>>> > >>>>>> function setDate(form) { > >>>>>> form.dateField.value = new Date().toString(); > >>>>>> } > >>>>>> > >>>>>> > >>>>>> Example assumes a hidden form input field with name dateField. > >>>>>> > >>>>>> HTH, > >>>>>> > >>>>>> Jon > >>>>>> > >>>>>> Vinu Varghese wrote: > >>>>>> > >>>>>> > >>>>>>> SK, > >>>>>>> That javascript prints the current client time. But I want the > >> client > >>>>>>> time with the request. > >>>>>>> The scenario is : > >>>>>>> > >>>>>>> I have a index.jsp > >>>>>>> > >>>>>>> <%@ page language="java" contentType="text/html; charset=ISO-8859- > 1" > >>>>>>> pageEncoding="ISO-8859-1"%> > >>>>>>> > >>>>>>> > >>>>>>>
> >>>>>>> > >>>>>>>