In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "springmvc processing model data ModelAndView process analysis", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "springmvc processing model data ModelAndView process analysis" bar!
Springmvc provides the following ways to output model data:
(1) ModelAndView: when the value type returned by the processing method is ModelAndView, the method body can add model data through this object.
(2) Map and Model: when the input parameter is org.springframework.ui.Model, org.springframework.ui.ModelMap or java.uti.Map, when the processing method returns, the data in Map will be automatically added to the model.
(3) @ SessionAttributes: automatically add some data from the model to the model.
(4) ModelAttribute: after the annotation is marked with the input parameter of the method, the object of the input parameter is put into the data model.
Use ModelAndView:
SpringmvcTest.java
@ RequestMapping ("/ springmvc") @ Controllerpublic class SpringmvcTest {private static final String SUCCESS = "success"; @ RequestMapping (value= "/ testModelAndView") public ModelAndView testModelAndView () {String viewName = SUCCESS; ModelAndView modelAndView = new ModelAndView (viewName); / / add model data to MOdelAndView modelAndView.addObject ("time", new Date ()); return modelAndView;}}
Index.jsp
TestModelAndView
Success.jsp
Success
Time:$ {requestScope.time}
After starting the server:
Click:
Successfully passed time to the view.
Thank you for your reading, the above is the content of "springmvc processing model data ModelAndView process analysis". After the study of this article, I believe you have a deeper understanding of the problem of springmvc processing model data ModelAndView process analysis, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.