简体   繁体   English

播放框架中的发布方法混乱

[英]Post method confusion in play framework

hi everyone i am a newbie to play framework following a first tutorial of play framework i hav little confusion POST and GET in play ... 大家好,我是玩游戏框架的第一个教程之后的新手,但是我在玩游戏时有点困惑POST和GET ...

is it always necessary to have a GET request for a Post request to happen can't we send data in post request . 是否总是需要一个GET请求来执行Post请求,否则我们不能在post请求中发送数据。

routefile 路由文件

POST         /delete_task:id         controllers.Data.deleteTask(id:String)

controllerfile 控制器文件

    public static Result deleteTask(String id) {
    return ok(id);
}

when i change it to GET method i works Can't send data in post request ! 当我将其更改为GET方法时,我无法在请求后发送数据! Thank you in advance !!! 先感谢您 !!!

GET         /delete_task/:id         controllers.Data.deleteTask(id:String) 
  • can be the missing '/' 可能是缺少的“ /”
  • Or, since you are providing value from the URL, which isn't actually a POST behaviour 或者,由于您是通过URL提供值,实际上这不是POST行为
  • Or, if you were really trying to send POST data then, deleteTask(id:String) don't need to provide arguement type 或者,如果您确实要发送POST数据,则deleteTask(id:String)不需要提供争论类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM