From a technical point of view, you can only use GET
to perform almost every operation, but ...
GET
is the most common method, and it is used when you do this. click on the link to get the data (and not change it on the server), if necessary, you send the identifier of the resource that you want to receive (if you need to get the data of one user).POST
most often used to send new
data to the server, i.e. from form
- save them in your database (or execute them in any other way).
There are other request methods (ie DELETE
, PUT
) that you can use with Play, however some of them need to be "emulated" through i.e. ajax, since it is not possible to set the shared link method, i.e. until DELETE
. He described how to use non-GET / POST methods in Play! (note that Julien suggests there, using GET to DELETE
actions, although maybe it's broken semantics.)
There are other discussions in StackOverflow where you can find examples and suggestions on choosing the right method for your routes.
BTW, if you send a request, say POST
you do not need to perform a separate GET
, since sending a request
generates a response
other words, after sending a new question using POST
, you first try to save it to the database if no errors display the page and Do not send it back.
source share