I want to display html files dynamically (last modified at the top) using JSP/Servlet. Please help me .
-
1can you explain your requirement bit moreJigar Joshi– Jigar Joshi2011-05-13 10:21:27 +00:00Commented May 13, 2011 at 10:21
-
in one folder we are storing html documents, in my browser i want to display last updated 3 documentsuser752140– user7521402011-05-13 10:25:28 +00:00Commented May 13, 2011 at 10:25
Add a comment
|
1 Answer
You will have list of file in your DIR. so using
listFiles()retrieve all files.Take them in Collection.
Implement a Comparator and use
lastModified()to compare and sort . and take first n files and displayPut this logic in service classes and call them from servlet