In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Today, the editor will share with you the relevant knowledge points about how to solve the failure of the ModelAndView jump page in ssm, the content is detailed, and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
All right, cut the crap and get to the point.
1. Import package
Import org.springframework.web.servlet.ModelAndView
Check to see if it is misquoted. Probably not, the key point is to watch servlet. Ha, don't scan it as a whole and say it's right.
2. Make no mistake about spring's xml configuration file.
The above is the configuration bean used by the editor, and then because my project is maven, I directly changed the default "/ WEB-INF/jsp/" to "/ jsp", and my file directory looks like this:
3. As for whether it is not possible to use ajax, because ajax has a callback attribute, I generally do not use ajax to access modelandview. Here, the editor uses connection access controller to redirect the page using modelandview.
4. Do not write your click events in the form tag, because if your button is still submit, then you will not jump no matter how you click on his modelandview.
This time, the editor suffers from the fourth article, which is for reference only to avoid stepping on the pit.
A brief introduction to the points for attention of ssm's ModelAndView ModelAndView
Use the ModelAndView class to store the resulting data after processing and the view that displays the data. In terms of name, Model in ModelAndView represents the model, and View represents the view, which well explains the purpose of this class.
After the business processor calls the model layer to process the user request, the result data is stored in the model property of the class, the view information to be returned is stored in the view property of the class, and then the ModelAndView is returned to the Spring MVC framework.
The framework parses the object by calling the view parser defined in the configuration file, and finally displays the result data on the specified page.
The role of ModelAndView
The ModelAndView constructor can specify the name of the returned page, or it can jump to the specified page through the setViewName () method
The main use of ModelAndView
When there is data to be returned to the page for display, it is necessary to encapsulate the data in ModelAndView.
For example: display all users of the query on the page
ModelAndView modelAndView = new ModelAndView (); modelAndView.addObject ("name", encapsulated data); modelAndView.setViewName ("returned page"); these are all the contents of this article entitled "how to solve the failure of jumping pages using ModelAndView in ssm". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.