如何阅读与GWT的本地(客户端)文件? [英] How to read local (Client) file with GWT?

查看:128
本文介绍了如何阅读与GWT的本地(客户端)文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用GWT来读取和解析本地的csv文件。
编辑:这里的本地文件意味着客户端文件。



我知道我可以使用HTML5与JavaScript来实现,但我想用GWT来做到这一点。

这样做的一个方法是使用JavaScript Native Interface(JSNI),但是我认为它使用GWT的目的是很难的。



这样做的另一种方法是将文件上传到服务器,然后将其作为json发回。但我觉得这不是做这件事的最好方法。



请指教。编辑:我打算设计一个桌面应用程序,所以我尽量避免使用任何Web服务器脚本。

http://code.google.com/p/lib-gwt-file


I would like to use GWT to read and parse local csv file. EDIT: Local file here means client file.

I know I can use HTML5 with javascript to achieve that, but I would like to use GWT to do it.

One way of doing it is by using JavaScript Native Interface (JSNI), however I think it beats the purpose of using GWT.

Another way of doing this would be upload the file to server, and send it back as a json. But I feel it's not the best way of doing it.

Please advise. Thanks.

EDIT: I intend to design a desktop app, so I try to avoid using any web-server scripting.

解决方案

Using jsni doesn't beat the purpose of gwt, sometimes you need to use it as a wrapper to functionality not yet available in gwt or an external javascript library. Instead of writting jsni access to the file api you can use one of several third party libraries available that implement html5 file access, like http://code.google.com/p/lib-gwt-file

这篇关于如何阅读与GWT的本地(客户端)文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆