Show Topics
Hide Topics

 @FormParam annotation Example

If we have a HTML form having two input fields and submit button. Lets client enter those details and submit to the RESTful web service. Then the rest service will extract those details by using this @FormParam annotation.we can use @FormParam annotation to bind HTML form parameters value to a Java method

 

 

1.Create Dynamic web project in eclipse, convert that into Maven Project

 

 

2.Add Jersey jar files manually / through Maven by writing repo details in pom.xml

 

 

3.Create RESTFul webservice

 

 

4.Configure web.xml

 

 

5.HTML Form (index.html)

 

 

 

6.Test Webservice directly by using URL / writing webservice client

  1. http://localhost:8080/JAXRS-FormParam-Example/
  2. http://localhost:8080/JAXRS-FormParam-Example/rest/students/registerStudent

 

Download Example Code