re: load content of directory server side Options

79 views
Skip to first unread message

sc3sc3 .

unread,
Mar 28, 2010, 10:21:09 PM3/28/10
to google-we...@googlegroups.com
Jeff Chimene wrote:

> On 03/28/2010 11:19 AM, sc3sc3 . wrote:
>> hi
>> i have directory with images im my war file:
>> /war/images
>> how can i iterate over the contents of this directory
>> when my application starts
>> i have to build: List<String> imageNames
>> thanks for your time
>> sc3*2
>
> Can you define the images using a client bundle? See
> http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html

if i understand it right
using the above i have to manually define all the images

i would prefer reading the content of the directory 'on the fly'
there can be a lot of images

thanks

Chad

unread,
Mar 28, 2010, 11:24:52 PM3/28/10
to Google Web Toolkit
On the server, you can use Java (or whatever else you want). So, make
an RPC call from the client to the server to get the file names. You
could return a string array. On the server, it could be as easy as:

public String[] getImageNames() {
return new File('images').list();
}

Obviously, you would want to throw in some error checking and such.

HTH,
Chad

Reply all
Reply to author
Forward
0 new messages