haneefnb
asked on
how to get file count in servlets or jsp
hi i want to know how to get no.of files in a directory.
of course i use this code
int filecount=new File("images/ln/headings")
to find the no.of files in the images/ln/headings directory. but i get always returns value 8 even the ./headings folder contains 10 or 20 files.
my doubt is this .class file is in app/WEB-INF/classes folder, but my targeted file is in app/images/ln/headings folder. so how can i use the above code to getting the file count in images/ln/headings folder..
ASKER
thanks for u r reply
but what about the jsp code so please provide the jsp code for solving above problem
but what about the jsp code so please provide the jsp code for solving above problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> but what about the jsp code so please provide the jsp code for solving above problem
would be exactly the same, no need to change anything.
would be exactly the same, no need to change anything.
The solution was provided in the question
I provide the solution here, what problem did you have with it?
You wanted to know how to do this in jsp - i showed you at http:#24343499
was answered in my first post
its not where the class file is, it is where it is run from
use the absolute path to make sure you get the right directory
If its inside a webapp you can use the following to get the actual path of a file in the webapp
http://helpdesk.objects.com.au/java/how-to-get-the-path-of-a-file-in-a-web-application
What problem did you have with it?
its not where the class file is, it is where it is run from
use the absolute path to make sure you get the right directory
If its inside a webapp you can use the following to get the actual path of a file in the webapp
http://helpdesk.objects.com.au/java/how-to-get-the-path-of-a-file-in-a-web-application
What problem did you have with it?
which just copied what I already posted, nice work
:-)
use the absolute path to make sure you get the right directory
If its inside a webapp you can use the following to get the actual path of a file in the webapp
http://helpdesk.objects.com.au/java/how-to-get-the-path-of-a-file-in-a-web-application