1

Javaフォーム送信の結果として応答のWebコンテンツをフェッチする必要がある状況がありますが、フローが要求と応答ほど単純ではないため、少し注意が必要です。次のとおりです。

Submit button pressed -> Display page processing wait timer -> Display quick advertisement page -> Display page result.

「送信ボタンを押した」から始めて、「ページ結果の表示」の内容を表示し、その間のページをスキップしたい。

私はこのサンプルコードを持っていますが、それは一方向でのみ機能し、リクエストを送信し、レスポンスを受信します。

URL url;
InputStream is = null;
DataInputStream dis;
String line;

try {
    url = new URL("http://stackoverflow.com/");
    is = url.openStream();  // throws an IOException
    dis = new DataInputStream(new BufferedInputStream(is));

    while ((line = dis.readLine()) != null) {
        System.out.println(line);
    }
} catch (MalformedURLException mue) {
     mue.printStackTrace();
} catch (IOException ioe) {
     ioe.printStackTrace();
} finally {
    try {
        is.close();
    } catch (IOException ioe) {
        // nothing to see here
    }
}

どんなJavaライブラリでも私のためにそれを行うことができますか?前もって感謝します。

4

1 に答える 1

1

SeleniumWebドライバーを試してみることを検討してください。それはあなたが実装しようとしているものを持っているかもしれません。

于 2012-12-26T19:59:00.510 に答える