Role and usage of ModelMap in Spring MVC, mvcmodelmap

Source: Internet
Author: User

Role and usage of ModelMap in Spring MVC, mvcmodelmap

Role of ModelMap:

ModelMap objects are mainly used to pass control methods to pass data to the results page. Similar to the setAttribute method of request.

Therefore, to obtain data on the jsp page, you only need to put the data in the ModelMap object.

 

The specific method for storing data is as follows:

AddAttribute (String key, object value );

 

The method for obtaining data on the Jsp page is as follows:

$ {Key} obtains the data stored in ModelMap through the EL expression on the page. The key in {} corresponds to the key value in addAttributed ..

 

Modelmap itself cannot set the url address alias or physical jump address for page Jump, so we can set the jump url address alias or physical jump address through the return value of the Controller method.

Jump url: return: url;

 

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.