This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use getLastModified( HttpServletRequest ) in JSP ?

 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i get the functionality of how to use getLastModified(HttpServletRequest) in JSP ?
 
liny
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you tell me where is the "getLastModified" method in HttpServletRequest??
I can not find it!
 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic