0

私は GWT-RPC を使用してサーブレットを呼び出してデータをエクスポートしようとしています。ケースを単純化するために、RemoteServiceServlet に次のコードを使用して、最初に出力テキストをハードコードしようとしています。

public void exportHistory(ArrayList<String> sqlHistory){
    this.sqlHistory = sqlHistory;
    try {
        HttpServletResponse res = this.getThreadLocalResponse();
        res.setContentType("text/plain");
        res.setHeader("Content-disposition", "attachment; filename=history.txt");
        ServletOutputStream out = res.getOutputStream();
        out.println("test1");
        out.println("test2");
        out.flush();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

ただし、asyncCallback で onFailure(Throwable catch) を返すと、キャッチされるのは InvocationException です。何が問題ですか?

4

1 に答える 1

0

jsonリストを渡すためにオブジェクトを使用してみてください。

于 2012-11-09T04:34:24.407 に答える