Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4617700
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:09:41+00:00 2026-05-22T02:09:41+00:00

I have to update a Person record having firstName and lastName. User should be

  • 0

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.

Here is my 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();
    }

the SOP statements prints null. I have been using Mozilla Firefox’s Poster plugin to send PUT request.

I also tried by annotating it with @Consumes(MediaType.APPLICATION_FORM_URLENCODED) but still it is printing null for each values.

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


If I send PUT request using Firefox’s RESTClient and Google’s rest-client I am able to get the form parameters. Both this tool has something like body section where I placed firstName=Amit&lastName=Patel. Also I added header Content-Type as application/x-www-form-urlencoded.I think Firefox’s Poster 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:09:42+00:00Added an answer on May 22, 2026 at 2:09 am

    In addition to annotating your method with @Consumes(MediaType.APPLICATION_FORM_URLENCODED), you must send application/x-www-form-urlencodedas a content-type. Did you do it?

    Edited: You can use FormParams only with POST:

    SRV.4.1.1 When Parameters Are Available The following are the
    conditions that must be met before post form data will be populated to
    the parameter set:

    1. The request is an HTTP or HTTPS request.
    2. The HTTP method is POST.
    3. The content type is application/x-www-form-urlencoded.
    4. The servlet has made an initial call of any of the getParameter family of methods on the request object. If the conditions are not met
      and the post form data is not included in the parameter set, the post
      data must still be available to the servlet via the request object’s
      input stream. If the conditions are met, post form data will no longer
      be available for reading directly from the request object’s input
      stream.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have passed in a viewmodel with a PERSON record with multiple addresses
In my company we have a screen with fields of a person . User
I want to do something like this.. I have a update form in PHP,
I have update panel that content check box, textbox, 3 DropDownList with CascadingDropDown extender.
I have scenario, I have two update panels on the page (both have update
I have an UPDATE statement that's intended to update a status field for a
I have an update program that is completely independent of my main application. I
I have and Update Panel with a Grid inside of it. The grid's data
I have the update frequency of my ClickOnce application set to weekly. What is
I have three update statements to be executed in PHP, i am getting the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.