3

I am trying to retrieve params from a POST request with the Java Play Framework (2.3.x).

Here is my post request:

$.post(
    "/some/endpoint",
    {
        "thingId": 12345,
        "otherThingId": 1234
    },
    function (data) { /* Do some stuff. */ },
    "json"
);

And this is in my controller:

public static Result SomeEndpoint() {
    DynamicForm params = Form.form().bindFromRequest();

    System.out.println(params.get("thingId"));
    System.out.println(params.get("otherThingId"));
}

Unfortunately, I never get any of the params I am trying to send. Anybody know what I am doing wrong?

Thanks!

2

1 Answer 1

0

All I can say is that I am doing the same to extract data out of post.

Did you tried clean compile the project in the sbt command line ?

Do you have a route like this :

POST /some/endpoint controllers.MyController.SomeEndpoint()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.