title: JAX-RS with Jersey: Passing form parameters to PUT method for updating a Resource
body: <p>I have to update a Person record having firstName and lastName. User should be able to change it from html form and on submit it should be updated.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>    @PUT
      @Path("/{userId}")
      public Response updatingResource(@FormParam("firstName") String firstName, @FormParam("lastName ") String lastName , @PathParam("userId") String userId){
          System.out.println(firstName);
          System.out.println(lastName);
          return Response.ok().build();
      }
  </code></pre>
  
  <p>the SOP statements prints null. I have been using Mozilla Firefox's Poster plugin to send PUT request. </p>
  
  <p>I also tried by annotating it with <code>@Consumes(MediaType.APPLICATION_FORM_URLENCODED)</code> but still it is printing null for each values.</p>
  
  <p>How to write and call PUT method that receives these three values. I stumble around lot and found people were asking to use JSON or XML. How can I consume JSON? I would be very greatfull if someone help me to write REST method to update a resource</p>
  
  <hr>
  
  <p>If I send PUT request using Firefox's <a href="https://addons.mozilla.org/en-US/firefox/addon/restclient/" rel="nofollow">RESTClient</a> and Google's <a href="http://code.google.com/p/rest-client/" rel="nofollow">rest-client</a> I am able to get the form parameters. Both this tool has something like body section where I placed <code>firstName=Amit&amp;lastName=Patel</code>. Also I added header <code>Content-Type</code> as <code>application/x-www-form-urlencoded</code>.I think Firefox's <a href="https://addons.mozilla.org/en-US/firefox/addon/poster/" rel="nofollow">Poster</a> is buggy. Can anyone suggest me is there any other way I should validate the code or I can trust on first two REST clients?</p>