【问题标题】:Parameters of a GET request are put into the query string of the URL. In a POST request, they are in the request body, so what does the URL look like?GET 请求的参数被放入 URL 的查询字符串中。在 POST 请求中,它们位于请求正文中,那么 URL 是什么样的?
【发布时间】:2018-10-14 02:14:44
【问题描述】:

例如,我可能有一个使用 get 方法并生成 URL 的 HTML 表单:

http://localhost:8080/HelloForm?Name=Gareth+Wylie&Age=24&Formula=a+%2B+b+%3D%3D+13%25%21

对于键值对:

Name: Gareth Wylie 

Age: 24 

Formula: a + b == 13%!

对于HelloForm.java(例如使用 java servlet)

如果我有相同的 HTML 表单,但使用了 POST 请求,那么 URL 会是什么样子?

【问题讨论】:

    标签: java http url post servlets


    【解决方案1】:

    URL 将与GET 相同,但省略了查询参数。那就是:

    http://localhost:8080/HelloForm
    

    【讨论】:

    • 哥们,当我读到这篇文章时,一切都点击了。结果我真的被所有事情弄糊涂了,我的问题并不准确,并不代表我认为的那样......谢谢!!!!
    • 不客气。我在开始 Web 开发时也有过挣扎。所以请不要犹豫。
    猜你喜欢
    • 1970-01-01
    • 2014-07-19
    • 1970-01-01
    • 2020-09-10
    • 1970-01-01
    • 1970-01-01
    • 2020-06-30
    • 2021-03-22
    • 2018-12-14
    相关资源
    最近更新 更多