struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nabbler12999 <karamsarkale...@gmail.com>
Subject Reading directory in JSP file (Struts 1.3)
Date Tue, 26 Aug 2008 18:41:13 GMT

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-tp19167854p19167854.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message