在谷歌 GWT 中读取文本文件? [英] Read text file in google GWT?

查看:10
本文介绍了在谷歌 GWT 中读取文本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 GWT 编写网页.现在我需要读取一个文本文件并在网页中显示内容,但不知道如何使用 GWT.

I am writing a webpage using GWT. Now I need to read a text file and display the content in the webpage but have no idea how to do that with GWT.

如果 GWT 中有任何方法可以读取 .properties 文件,那就太好了.(请注意,这不是 GWT 已经支持的本地化属性文件)

It is very nice if there is any way in GWT that I can read .properties file. (Please note that this is not the properties file of localization that GWT has already supported )

请问大家有什么想法吗?

Does anyone have an idea, please?

谢谢.

推荐答案

您可以使用 RequestBuilder

new RequestBuilder(RequestBuilder.GET, "path/to/file.txt").sendRequest("", new RequestCallback() {
  @Override
  public void onResponseReceived(Request req, Response resp) {
    String text = resp.getText();
    // do stuff with the text
  }

  @Override
  public void onError(Request res, Throwable throwable) {
    // handle errors
  }
});

这篇关于在谷歌 GWT 中读取文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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