0

I want to display html files dynamically (last modified at the top) using JSP/Servlet. Please help me .

2
  • 1
    can you explain your requirement bit more Commented May 13, 2011 at 10:21
  • in one folder we are storing html documents, in my browser i want to display last updated 3 documents Commented May 13, 2011 at 10:25

1 Answer 1

2
  • 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 display

  • Put this logic in service classes and call them from servlet

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.