Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use springmvc temporarily not to use the automatic prefix of the view parser

Shulou Source: shulou.com Published: 2022-06-03 08:59:30 11月15日 Update

This article mainly shows you "how to use springmvc temporarily do not use the view parser to automatically add prefix", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use springmvc temporarily do not use view parser to automatically add prefix" this article.

Springmvc temporarily does not use the automatic prefix of the view parser

When you configure a parser such as the above parser in springmvc.xml, the return address of action is prefixed by default, but sometimes you need to visit a non-jsp page or a view that is not the path above.

Solution method

Precede the view name in action with "request:" (forward) or "redirect:" (redirect).

ModelAndView mv = new ModelAndView (); mv.setViewName ("redirect:/index.jsp"); prefix and suffix usage of springmvc view parser

When there is no suffix:

ModelAndView.setViewName ("/ WEB-INF/jsp/items/itemsList.jsp")

When you have a suffix:

ModelAndView.setViewName ("items/itemsList"); the above is all the content of the article "how to use springmvc temporarily without using the automatic prefix of the view parser". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Suffixes views content articles methods learning help usage prefixes picture names addresses such as above easy to understand more sometimes organization knowledge editing industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information NVidia Shulou Tech Info OPPO Reno