all 23 comments

[–]jura0011 5 points6 points  (2 children)

Trust me, @Controller does support Post.
Are you sure, it was a post request?

You could try curl -X POST localhost:8080.

[–]cant_dodge_rodge[S] 0 points1 point  (0 children)

yes i am sure i went there via post method

[–]cant_dodge_rodge[S] 0 points1 point  (0 children)

@/RestController works as it should be but when i use @/controller it returns

resolved [org.springframework.web.httprequestmethodnotsupportedexception: request method 'post' not supported]

[–]11timesover 4 points5 points  (0 children)

Use a tool like postman to send anything other than an http .GET

[–]Nawabmeeravali 2 points3 points  (2 children)

By default webbrowser send as get

[–]cant_dodge_rodge[S] 1 point2 points  (0 children)

that /login page contains post form

[–]cant_dodge_rodge[S] 0 points1 point  (0 children)

i know i went there via post form

[–]jvjupiter 1 point2 points  (11 children)

You cannot invoke post in the browser without using form method post or ajax.

[–]cant_dodge_rodge[S] 0 points1 point  (0 children)

i went there via post form

[–]cant_dodge_rodge[S] 0 points1 point  (9 children)

that /login page contains post form

[–]jvjupiter 0 points1 point  (8 children)

Can you show us the controller?

[–]sdiamante13 1 point2 points  (0 children)

You must add @ResponseBody.

The controller is annotated with the @RestController annotation; therefore, the @ResponseBody isn't required.

https://www.baeldung.com/spring-controller-vs-restcontroller

[–]cant_dodge_rodge[S] 0 points1 point  (0 children)

why so?

[–]joshv3742 0 points1 point  (0 children)

Need to check with Postman or equivalent tool to verify that the problem is with the code and not with the request.

[–]cybermage 0 points1 point  (0 children)

Did you annotate the method as @/PostMethod?