File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use getLastModified( HttpServletRequest ) in JSP ?
 
Similar Threads
Non-scripting....
getLastModified(..)
how to use getLastModified() ?
getLastModified() not working in JSP
is there any getLastModified example?