Jersey @FormParam Example

 

In Jersey REST, the @FormParam annotation is used to bind the parameters value of an HTML form to a service method arguments.

In this example, we will see how to use @FormParam to parse and display the parameters value submitted by an HTML form.

 

1. Project structure

Jersey-FormParam-Example

 

2. HTML form

We will use an HTML form with two parameters.

In the action attribute we indicate the path of the service method which will process the form content.

 

3. RESTful service

We use @FormParam to retrieve the value of the form parameters binded to the method arguments.

 

4. Test It

URL : http://localhost:8080/Jersey-FormParam-Example/login.html

Jersey-FormParam-Example-1

 

Jersey-FormParam-Example-2

 

Download source code