开发者

SmartGWT Server File Browser

I have been looking for a SmartGWT example that would show me how to build a File Browser widget that takes the files from the local server's root directory. The user would be shown the files through the browser which they could then select to perform some processing operat开发者_JAVA技巧ions.

So far I have thought of using SmartGWT's Tree->Data Binding->Load from Local Data Widget and then grabbing a list of the directories using:

new File("\").listFiles();

My Question is: Is there a better way to do this? Has someone already thought of this and has an example of their code that I can see?

PS: I'm fairly new to GWT and Web Services but fairly competent with Java. If you believe there is a better way to do this (while still doing this through the web and not using Applets, please tell me).

Thanks


Ideally you want to set this up as a DataSource so you can handle large file systems by incrementally loading tree data.

This is actually built into the Pro edition - there is an included FilesystemDataSource that is present if you inherit the tools module (see this faq). It supports all 4 CRUD operations (browse files, add files, remove files, update files). It can be enabled in server.properties (FilesystemDataSource.enabled:true).

If you prefer to write the server code yourself, use DMI. See the QuickStart Guide chapter on the Server Framework for details.

Finally, if you don't have Pro, the RestDataSource provides a cookbook server integration path (more work than with Pro, but relatively straightforward if you are familiar with servlets, XML/JSON serialization, etc).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜