Is there any way to get the Last Modified date of a JSP source file from that file? I want my JSP to have a display of the last modification automatically.

Serge Knystautas

There's nothing in the JSP spec (unfortunately) to get the last modified date, but you can use the servlet context object and the File API to get it.

<%@ page import="java.io.*,java.util.*" %>
<%
String filename = application.getRealPath(request.getRequestURI());
File file = new File(filename);
%>
<%=new Date(file.lastModified())%>
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact