Hey!
This question is on-topic for SERVLET-INTEREST.
Sorry, I don't know why you are getting back a -1.
-1 means that it could not find it in the date header field.
Have you tried "Last-Modified".
Try this in your servlet:
Enumeration e = request.getHeaderNames();
while (e.hasMoreElements()) {
String nam = (String) e.nextElement();
String val = request.getHeader(nam);
if (val != null)
out.println( nam + " > " + val);
You have to get some date back, I think. I haven't checked the servlet
spec. :>)
Maybe you could check the spec. and let the E-list know what you found.
Send a code snippet. Maybe you are making some other error.
Oh, please turn off you HTML and use text-only to post the E-list.
Sans adieu,
Danny Rubis
Steven Lau wrote:
> Hi, DannyThanks for replying and I'm really sorry about the fact I
> asked the question at the wrong place. I'm really new to Java and
> servlet, it's actually the first time I'm writing them. I actually
> looked at the docs before asking and tried what you recommended but
> didn't work. I later found out that the problem is due to using
> "Long" instead of "long" to declare my variable. I hope you don't
> mind me asking you another question. When I do the following: long
> now = request.getDateHeader("If-Modified-Since"); "now" is always -1
> instead of the time when the servlet was requested. Can you help me
> out with this? And where do you suggest that I ask this kind of
> question next time? Thanks again,Steven
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html