getLastModified()方法返回的是Header里的内容,如果没有这一项就返回零,也就是70年1月1日。
public long getLastModified()
Returns the value of the last-modified header field. The result is the number of milliseconds since January 1, 1970 GMT
所以不妨看看是不是服务器的问题?
public long getLastModified()
Returns the value of the last-modified header field. The result is the number of milliseconds since January 1, 1970 GMT
所以不妨看看是不是服务器的问题?
http://www.samsungmonitor.com.cn/Products/151S.html 这个就是正确的我也没看出什么来啊不过有时候这两个函数(获得时间和大小的)会抛出下面这个异常java.net.MalformedURLException: no protocol:
getLastModified()是HttpServlet的方法
getContentLength()是request的方法
打开网页后 在 地址栏里输入 javascript:document.lastModified
可以看到这个网页的最后修改时间不过 getLastModified() 这个函数一般是用在 Servlet 中的
public int getContentLength()
Returns the value of the content-length header field. Returns:
the content length of the resource that this connection's URL references, or -1 if the content length is not known.
http://ent.163.com/edit/030217/030217_151910.html unix机器apache
http://www.samsungmonitor.com.cn/Products/151S.html windows机器iis我个人觉得有点难。我过会儿再看看吧。
关注!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!