Post 使用 Jsoup 的文本区域数据

Post textarea data with Jsoup

目前,我正在尝试使用 Jsoup post 一些表单数据。 这适用于普通输入类型字段,但不适用于文本区域字段。 你知道如何使用 Jsoup post textarea 数据吗?

我的 html 表格看起来像这样:

<form action="" method="post">
    <input type="text" name="input1">
    <input type="checkbox" name="input2">
    <textarea name="input3"></textarea>
    <input type="submit">
</form>

我的 Jsoup 代码看起来像这样:

Response response = Jsoup.connect(URL)
                    .method(Method.POST)
                    .data("input1", "something")
                    .data("input2", "something else")
                    .data("input3", "textarea content")
                    .execute();

它在哪些方面不适合您?您的响应代码是什么?我无法重现问题:

使用 w3schools echo form 文本区域按预期设置:

try {
    Response response = Jsoup.connect("http://www.w3schools.com/php/demo_form_validation_complete.php").method(Method.POST).data("name", "some name").data("email","mail@mail.com").data("comment", "some test input in textarea").data("gender", "male").execute();
    System.out.println(response.body().toString());
} catch (IOException e) {
    e.printStackTrace();
}

输出(摘录):

<h2>Your Input:</h2>some name<br>mail@mail.com<br><br>some test input in textarea<br>male