In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "What is Sping MVC". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "What is Sping MVC"!
1. what is MVC
MVC is a very popular framework, by separating the Model(dao), View (jsp), Controller(action), the more complex web application into several parts of clear logic, is a sub-framework of spring.
2. Information flow: The user requests to the server through HTTP, and the server will forward the request to different controllers according to your url. Controller
3. Method 1: In the configuration file of springmvc, directly write the bean name as a url. For example, through this configuration, the request for the url of/product_input is directly forwarded to the class ProductInputController.
Method 2: This way, when naming Controller, it doesn't matter, its mapping is not dependent on this name, so you can write the configuration of this bean in the following way, you can start one at random, such as here, obviously still do not implement the url to Controller mapping, because url has not seen it, now springMVC has a comment is RequestMapping, specifically responsible for mapping url, for example, need to map to ProductInputController addProduct() this method, Just add an annotation to this method, such as @RequestMapping(name="product_input") addProduct(). With this annotation, you can map the url of product_input to the method addProduct.
4. MVC: View is a view presentation. The user's browser sees a beautiful web page, which is HTML, which is responsible for presenting bitter data into various styles, so that ordinary users look good, rather than a bunch of JSON data. After the user's request comes in, it must still be returned to the user's page. Each page is a VIEW. View is like the frame of a web page. The frame of a certain page is fixed, and the difference is the data therein. A shopping cart page, for example, is a frame. Your shopping cart and mine generally look the same, but the specific content is different, because the goods purchased are different, and this specific thing, or data, is the Model. Now M and V have it.
When the request has reached the Controller, the role of this class is to: 1. select the appropriate view to return to the user, 2. organize the data, that is, generate the Model. Network transmission and information technology mainly deal with data, and now the data is placed in the Model, or the place where the data is placed is called the Model, for example, the user is requesting to query the user information, then what the Controller does is to find this information in the database, and then add the information to the Model, and then return the Model and the corresponding View together to the DispatcherServlet.
At this point, I believe that everyone has a deeper understanding of "what Sping MVC is", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
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.