Difference between JAX-RS @PathParam and @FormParam?

Asked on March 11, 2015
What is difference between JAX-RS @PathParam and @FormParam?

Replied on April 17, 2015
@PathParam and @FormParam both are the JAX-RS API.

PathParam can be used as 



public String add(@PathParam("id") Integer id, @PathParam("name") String name ){
         return "result";

For more detail, find the URL

@FormParam is used to access data from web request as form. Suppose we a form as  

     <form method="POST" action="/resteasyservice-1/employee/manage/save">
       Id:  <input type="text" name="id"/><br/>
        Name: <input type="text" name="name"/><br/>
        Company: <input type="text" name="company"/><br/>
        <input type="submit" value="Submit"/>

We can use @FormParam as 

public String saveEmp(@FormParam("id") String id, @FormParam("name") String name, 
                         @FormParam("company") String company) {
    return "result";

Find the URL for the detail.

Write Answer

©2024 concretepage.com | Privacy Policy | Contact Us