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 7005053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:18:11+00:00 2026-05-27T21:18:11+00:00

I want to make a form in which I can update my entity in

  • 0

I want to make a form in which I can update my entity in my REST application. For example I have a User entity whith username and realname fields.

Do I need in my request method do something like this

    @RequestMapping(value = "/admin/user/update", method = RequestMethod.POST)
public String updateHouse(@RequestBody String username, @RequestBody String realname, Model model) 

??

I would prefer to make something like this

@RequestMapping(value = "/admin/house/update", method = RequestMethod.POST)
public String updateHouse(@RequestBody User user, Model model) 

I mean that I want to send an object not every field. If i`ll have 20 fields in my entity I would have to add 20 params to my method. Thats not to fancy.

I`m using spring form tag

——- UPDATE

thanks for response. below diffrent entity but real case scenario that i`m trying to start

html code

<c:url var="houseUpdateLink" value="/admin/house/update" />
<form:form method="post" commandName="house" action="${houseUpdateLink}">
    <form:input path="house.title" />
<input type="submit" value="send" />
</form:form>

controller method

@RequestMapping(value = "/admin/house/update", method = RequestMethod.POST)
public String updateHouse(@RequestBody House house, Model model) {
    model.addAttribute("step", 3);

    logger.info("test: " + house.getTitle());
    return "houseAdmin";
}

and i receive

HTTP Status 415 -

type Status report

message

description The server refused this request because the request entity is in a format     not supported by the requested resource for the requested method ().
  • 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-27T21:18:12+00:00Added an answer on May 27, 2026 at 9:18 pm

    You don’t need @RequestBody here. Spring will automatically bind the form fields to the House class without it, i.e.

    @RequestMapping(value = "/admin/house/update", method = RequestMethod.POST)
    public String updateHouse(House house, Model model) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a user-registration form where I will have fields such first
I want to update a field in my html form separately from the rest.
I have currently a website which lets every user register, but I want to
I want to make a form like this, and i want to post the
I want to make a form like this in windows forms. To make a
I'm starting my first C# project, and I want to make a form designer
I want to make an HTML form with 2 select boxes. The selected option
I want to make routing for form when submitting the form, $reportRoute = new
I want to refer to this post, because it might relate: Make Form Fields
I want to make a edit profile form for my website. My idea is

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.