wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes how to use getLastModified( HttpServletRequest ) in JSP ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "how to use getLastModified( HttpServletRequest ) in JSP ?" Watch "how to use getLastModified( HttpServletRequest ) in JSP ?" New topic
Author

how to use getLastModified( HttpServletRequest ) in JSP ?

hasan khan
Ranch Hand

Joined: Aug 04, 2003
Posts: 222

How can i get the functionality of how to use getLastModified(HttpServletRequest) in JSP ?


SCJP, SCWCD
liny
Greenhorn

Joined: Dec 08, 2004
Posts: 10
Could you tell me where is the "getLastModified" method in HttpServletRequest??
I can not find it!
hasan khan
Ranch Hand

Joined: Aug 04, 2003
Posts: 222

I did'nt mean like that. (there are some typing mistake in my question)
I know it is in javax.servlet.http.HttpServlet.
It is there to be overriden by the subclass of javax.servlet.http.HttpServlet. but how do I achive that functionality in JSP.
Nitish Bahadur
Ranch Hand

Joined: Aug 25, 2003
Posts: 118
<%@ page import="java.util.*, java.text.*, java.net.*, java.io.*" %>

<%
URL url =
pageContext.getServletContext().getResource(request.getServletPath());
File file = new File(url.getFile());
long miliseconds = file.lastModified();
Date lastModified = new Date(miliseconds);
%>
<%= file.getName() %> last modified @ <%= lastModified %>

Will this work?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to use getLastModified( HttpServletRequest ) in JSP ?
 
Similar Threads
how to use getLastModified() ?
is there any getLastModified example?
getLastModified(..)
getLastModified() not working in JSP
Non-scripting....