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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:04:51+00:00 2026-05-15T00:04:51+00:00

What are the benifits of using ModelMap instead of a simple Map in Spring

  • 0

What are the benifits of using ModelMap instead of a simple Map in Spring MVC. I see in the code implementation that they put the datatype of the attribute added in the map as key instead to be made available on the form.

Can anyone explain with an example.

  • 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-15T00:04:52+00:00Added an answer on May 15, 2026 at 12:04 am

    ModelMap subclasses LinkedHashMap, and provides some additional conveniences to make it a bit easier to use by controllers

    • addAttribute can be called with just a value, and the map key is then inferred from the type.
    • The addAttribute methods all return the ModelMap, so you can chain method called together, e.g. modelMap.addAttribute('x', x).addAttribute('y',y)
    • The addAttribute methods checks that the values aren’t null
    • The generic type of ModelMap is fixed at Map<String, Object>, which is the only one that makes sense for a view model.

    So nothing earth-shattering, but enough to make it a bit nicer than a raw Map. Spring will let you use either one.

    You can also use the Model interface, which provides nothing other than the addAttribute methods, and is implemented by the ExtendedModelMap class which itself adds further conveniences.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working at a development shop that is using outdated bug tracking software. They're
what are the benefits of using HTTP authentication with PHP (HTTP 401 headers) instead
What are the benefits of using the xml datatype versus storing the xml content
What benefits has using std::reference_wrapper as template parameter of containers instead of raw pointers?
What are the benefits of using attr() instead of using addClass() in jquery?
What are benefits of using these operators instead of implicit casting in c++? dynamic_cast
What are the benifits of using a value class in C++/CLI.Can the value class
I'm doing a code review for one project. It's architecture you can see on
For all the benefits of using debugging tools which let you stepthrough the code,
What are the benefits of using variadic functions void fun(int i, ...); instead of

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.