>From a Java point of view:
JSP is just a file. You could use the java.io.File  and use the
lastModified() method that returns a long representing milliseconds and
then do the Date thing from there.

>From a Web Design point of view:
It is not normally recommended to display this information that visitors
can read. It tends to make your site seem old quickly. Thanks to portal
sites, people see pages change almost constantly. If you want to make
sure that this is on the page, it is recommended to place it as an html
comment so that it can be viewed via a 'view source code' command.


- Greg Jones
919-873-1416
Counterpoint Designs, Inc. - Enterprise & Hosting Solutions
Certified  Historically Underutilized Business (HUB)
www.counterpointdesigns.com
 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Richard O. Hammer
Sent: Saturday, April 05, 2003 8:29 AM
To: Java Users Group
Subject: [Juglist] automated page-update report in JSP


Using JSP, I would like to have an update report at the bottoms of my
pages with a message such as: "This page last updated on March 18,
1995".  I want it to be honest, telling the save-date of the jsp file, 
the date when I actually last edited the file.

I hoped that I would achieve this by using the code below, which I 
think should capture the date when the servlet was compiled, which I 
thought would be close enough to the date when I most recently saved 
the file.  But it looks like the servlet gets recompiled every time I 
restart Tomcat, or, to be more specific, the date which this shows is 
the first date after Tomcat has been restarted on which the page is 
accessed.

So, I'm looking for suggestions.  How can I automate the honest 
updating of my "page updated" reports?

Thank you,
Rich Hammer
Hillsborough, N.C.


Near the bottoms of my JSPs I am using this line:
<[EMAIL PROTECTED] file="updateReport.jsp" %>


And here is that file, updateReport.jsp:

<%@ page import="java.text.DateFormat,java.util.Date" %>
<%!
    static DateFormat dateFormat =
DateFormat.getDateInstance(DateFormat.LONG);
    static String compileDate = dateFormat.format(new Date()); %>
<center
      style= "font-size: smaller; font-family: sans-serif;
              font-style: italic; text-align: center;"
   >
    This page last updated on <%= compileDate %>
</center>




_______________________________________________
Juglist mailing list
[EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/2003
 


_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to