File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes how to read and list files in Jsp List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to read and list files in Jsp List " Watch "how to read and list files in Jsp List " New topic

how to read and list files in Jsp List

Kondal reddy

Joined: Sep 23, 2003
Posts: 22
how can I read and list files in my Jsp List, from my C:/Folder/

anybody can help
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
I think, you mean you want to list down all the file names, of a particular directory, in your JSP page. right?

If yes then its simple just get all the names of files present in particular directory, place them in a collection and then iterate that collection object in order to show the list.

Where is the problem?
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Use the java.util.File class for reading your directory.
Then, follow Adeel's directions.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63533

Of course you realize that you only have access to the server's file system. correct?

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: how to read and list files in Jsp List
It's not a secret anymore!