Thanks, I see.

nabbler12999 wrote:
> 
> Hello,
> 
> I want to read a directory. But canRead() gives false. How can I do it?
> 
> My code:
> [code]
> <%
> String filename="";
> File dir = new File("files");
> 
> String[] children = dir.list();
> 
> if (children == null) {
>       System.out.println("ERROR\t can read:"+dir.canRead());
>    // Either dir does not exist or is not a directory
> } else {
>       Random a = new Random(dir.length());
> 
>     filename = children[a.nextInt()];
> 
> }
> 
>     request.setAttribute("randomfile",filename);
> 
> %>
> [/code]
> 
> Thanks very much
> 

-- 
View this message in context: 
http://www.nabble.com/Reading-directory-in-JSP-file-%28Struts-1.3%29-tp19167854p19224496.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to