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)06/03 Report--
This article mainly introduces how to achieve controller interface jump to another controller interface, the article is very detailed, has a certain reference value, interested friends must read it!
The controller interface jumps to another controller interface @ RestController@RequestMapping ("/ aaa") public class TestController {@ RequestMapping ("/ test1") public ModelAndView test1 (HttpServletResponse response) {ModelAndView view = new ModelAndView (); view.setViewName ("redirect:/aaa/test2"); / / try {/ / response.sendRedirect ("/ test2") / /} catch (IOException e) {/ / e.printStackTrace (); / /} return view;} @ RequestMapping ("/ test2") public ModelAndView test2 () {System.out.println ("this is test2");}} method problem of calling another Controller in Controller
1. Cannot be called directly as a class
2. You can pass it to another Controller class and run it through url forwarding.
3. The service injected into Controller will report a null value if it is directly used as an instance variable.
4. Note that the Controller layer does not deal with complicated logic, and the logic should be handed over to the Service layer.
5. Static resource mapping, that is, static resource release. When the front-end controller intercepts "/", static resources such as .js, .jpg, .css need to be released.
6. / *, it will cause jsp,js,jpg. Are intercepted, can not be executed, generally do not use
The above is all the content of the article "how to implement the controller interface to jump to another controller interface". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow 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.