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

  • Home
  • SEARCH
  • 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 8993831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:17:00+00:00 2026-06-15T23:17:00+00:00

I am learning Spring MVC 3 and am not a Java expert in general.

  • 0

I am learning Spring MVC 3 and am not a Java expert in general. I have a few questions

  1. From what I can tell ModelAndView is not used anymore. I also see these two:
    • org.springframework.ui.Model
    • org.springframework.ui.ModelMap

What’s the difference between ModelMap and Model? Is one of them old style like ModelAndView?

  1. How can I pass form data back to the controller? Here’s what I have so far:

VIEW

<form action="/KSC/users/update" method="POST" class="form-horizontal" id="fEdit">

                            <input type="hidden" id="id" name="id" value="${record.id}" />

                            <div class="control-group">
                                <label for="userName" class="control-label"></label>
                                <div class="controls">
                                    <input type="text" id="userName" name="userName" value="${record.userName}" data-validation-engine="validate[required]" />
                                </div>
                            </div>

                            <div class="control-group">
                                <label for="email" class="control-label"></label>
                                <div class="controls">
                                    <input type="text" id="email" name="email" value="${record.email}" data-validation-engine="validate[required,custom[email]]" />
                                </div>
                            </div>

                            <div class="control-group">
                                <div class="controls">
                                    <input type="submit" value="Save" class="btn btn-primary" />
                                    <a href="/KSC/users" class="btn">Cancel</a>
                                </div>
                            </div>
                        </form>

EDIT ACTION

Here’s what I originally passed to the above View from the Edit action:

@RequestMapping(value = "/users/edit/{id}")
    public String edit(ModelMap model, @PathVariable("id") int userId) {
        KCSUser user = service.find(userId);
        model.addAttribute("record", user);
        return "user/edit";
    }

CONTROLLER UPDATE ACTION

@RequestMapping(value = "/users/update")
    public String update(ModelMap model) {
        //TODO
    }

I need to access the updated model data so i can save it to my DB. Ideally if it could map directly to a KSCUser object that would be nice.. but if not, then a Model or ModelMap would be fine too. How can I do this?

  • 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-06-15T23:17:01+00:00Added an answer on June 15, 2026 at 11:17 pm

    This seems to work:

    @RequestMapping(value = "/users/update")
        public String update(ModelMap model, @ModelAttribute("record") KCSUser record) {
    
            if (record.getId() == 0) {
                service.insert(record);
            }
            else {
                KCSUser existing = service.find(record.getId());
                existing.setUserName(record.getUserName());
                existing.setEmail(record.getEmail());
                //etc...
                service.update(existing);
            }
    
            return index(model);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning myself Spring MVC 2.5 mostly from the docs. Can someone explain
I have been learning java spring hibernate MVC for 3 months and got pretty
I have a simple ASP.NET MVC 3 dummy app (just learning MVC coming from
I am learning spring-mvc and I am doing a simple crud. I have a
I have been learning ASP.NET MVC in the last few months and I think
I am learning Spring 3.x MVC. I now have a regular web page setup
I have a service manager class used to abstract my calls from my MVC
I am learning MVC 3 and I have not found people using some logic
I'm working on an ASP.Net MVC project and have been learning a few little
I am learning both AJAX and the Java Servlet API (well, Spring MVC, which

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.