Springmvc Controller method Parameters What is the difference between the Modelmap and the model type?

Source: Internet
Author: User

Reference

http://blog.csdn.net/u013067598/article/details/69372309

http://blog.csdn.net/u013686993/article/details/52932079

The final incoming is Extendedmodelmap , it inherits the Modelmap , implements the Model interface,

Modelmap also inherits from HashMap.

Method of the Model interface

Methods of the Modemap class:

Methods of the Extendedmodelmap class:

Visible Extendedmodelmap method and Modelmap are the same, and what has increased, it is estimated that the function is enhanced.

And since Modelmap started to inherit the Haspmap, so many map methods

The model interface defines several methods for adding data to the model.

So the parameter type write Modelmap and model are correct, write map also can use, even can write Extendedmodelmap.

If you just read the data in the model and write the Map type, there is a get method that is enough to lose the Moel interface AddAttribute to add model data.

If you just write data to the model, it is sufficient to write a parameter of type AddAttribute, which can be done without the need of a haspmap get method.

Of course, the actual use of the words who still think so fine, make a modelmap read and write can be done!

Springmvc Controller method Parameters What is the difference between the Modelmap and the model type?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.