Pritesh Naik
Pritesh Naik

Reputation: 58

java web service get parameter while using post method

I did a java rest web service using GET method.The web service works fine with GET method.But when i try it with POST method it doesn't display anything. Below is my simple code to test it with POST method. Please anyone help me in solving this issue.

@Path("/post")
public class Testpost {

    @POST
    @Path("/test")
    public String POST(@QueryParam("param") String msg) {
        String output = "POST:hELLO: "+msg;
        return output;
    }
}

Upvotes: 1

Views: 47

Answers (1)

Suresh Atta
Suresh Atta

Reputation: 122026

 public String POST(@QueryParam("param") String msg) {

There will be no @QueryParam for POST. It is only for GET.

For POST, you should use @RequestParam

Upvotes: 2

Related Questions