Re: accessing files/dirs.....

2007-04-04 Thread maya
ok, I asked webhosting guy, this is what finally worked: /chroot/home///tomcat/webapps/india/delhi/images :) many thanks for yr help... David Smith wrote: What I posted was an excerpt from a jsp page writing the index of a folder -- no Struts in sight. "directory" was just an arbitrary req

Re: accessing files/dirs.....

2007-04-04 Thread David Smith
What I posted was an excerpt from a jsp page writing the index of a folder -- no Struts in sight. "directory" was just an arbitrary request parameter for example purposes: http://localhost:8080/myWebApp/imageList.jsp?directory=%2fsome%2fdirectory It doesn't really matter how you get that stri

Re: accessing files/dirs.....

2007-04-04 Thread maya
yes I know, eventually I want to do this whole webapp in struts.. for now just want to be able to count how many images in 'images' folder.. (what I don't get here is first line.. where does the reqParameter come from? (this method is usu. used to get params from request (user input, quer

Re: accessing files/dirs.....

2007-04-03 Thread David Smith
Ok... I think I'm starting to see the picture here. You want to be able to write a jsp that can list the directory contents of a folder. This is very crude, no error checking, untested, etc. but you'll catch on <% String reqParameter = request.getParameter( "directory" ) ;

Re: accessing files/dirs.....

2007-04-03 Thread Martin Gainty
asses-" { permission java.security.AllPermission; }; HTH Martin -- - Original Message - From: "maya" <[EMAIL PROTECTED]> To: Sent: Tuesday, April 03, 2007 4:42 PM Subject: Re: accessing files/dirs. thank you.. someone in another forum said the same thing.. prob

Re: accessing files/dirs.....

2007-04-03 Thread maya
thank you.. someone in another forum said the same thing.. problem is, if I have trouble accessing directory, how will I tell these methods to "get Resource" for that dir? :) (also, alas, don't quite remember how to use methods of interfaces -- since interfaces can't be instantiated, di

Re: accessing files/dirs.....

2007-04-03 Thread David Smith
I'm not sure what you're attempting to do here, but have you thought about ServletContext.getResource() and ServletContext.getResourceAsStream() ? Both are safe methods of reading resources from the webapp whether it be in a compressed archive or not. There is also getRealPath(), but it will

accessing files/dirs.....

2007-04-03 Thread maya
File dir = new File("C:\\apache-tomcat-5.5.17\\webapps\\india\\delhi\ \images"); this works fine in my machine locally, but on my website.. if, say, I'm in dir where 'images' dir is, this doesn't work... File dir = new File("images") starting @ root of webapp also doesn't work... F