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.
Asked
Active
Viewed 1.8k times
18
-
See http://stackoverflow.com/questions/27016995/for-a-get-operation-which-one-to-use-queryparam-or-formparam – Kalpesh Soni Feb 08 '16 at 18:07
-
Poorly worded, but it is hard to see why this was closed. It's a real question and has a real answer. – user207421 Sep 27 '19 at 10:20
1 Answers
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