18

What's the difference between an HTTP query parameter and an HTTP form parameter? I see the words in restful related documents. Can you give an example for the words in HTTP request.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
jiafu
  • 6,338
  • 12
  • 49
  • 73

1 Answers1

12

If you make request http://test.com?id=123, then id is a QueryParam (to be more precise this is GET request parameter), if you make POST request with a form inside body, then these form parameters (filled usually by user) are translated to FormParam-s.

Piotr Kochański
  • 21,862
  • 7
  • 70
  • 77
  • do you mean. the form parameter only be used in post method? If the post body is xml or json, what's the form parameters? If the form paramters only in style of key-value? Thanks. – jiafu Apr 09 '12 at 14:19
  • In theory you can sumbit form using any request type, but form submission suggests that you want to change some data, so the recommended request type would be POST for adding new data and PUT for updating existing data. – Piotr Kochański Apr 09 '12 at 14:53
  • Can't the FormParam be used with GET Method?? Say i have to get/fetch all the Employees with Department JAVA(like @FormParam String dept) using GET method. – Arun Kumar Oct 27 '15 at 06:32
  • In servlet world we simply use request.getParameter, how is it diff in jersey world? by the way this question is a valid thing, not sure why its closed – Kalpesh Soni Feb 08 '16 at 18:04