Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem that the page returned by SpringMvc cannot be redirected to modelandview?

Shulou Source: shulou.com Published: 2022-05-31 18:28:43 09月30日 Update

This article mainly introduces the SpringMvc page returned to modelandview can not jump the problem of how to solve the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe that after reading this SpringMvc page returned to modelandview can not jump how to solve the problem of the article will have a harvest, let's take a look at it.

On the problem of modelandview jump

Xiaobai has just begun to learn to use the springmvc framework, after configuring the simple web.xml file and the springmvc configuration file springmvc file, excitedly unloaded a simple helloworld test demo to see the effect. The request path to the controller is: login.do; control

Device returns an instance of modelandview after processing, and sets the

As usual, he should jump to the helloworld.jsp page, but he still jumps to login.jsp, and many times he jumps to login.jsp (this page does not exist, this is the path to the controller). After many attempts were fruitless, they turned to du Niang and finally found the problem! It is because the introduced package is misled! What I'm introducing is

This package, but what should be introduced is

These two packages look very much alike, and mistakes will be introduced a little carelessly, resulting in a jam in the development, especially for a rookie like me who is just getting started.

Modelandview jump error

When the code is executed to the control layer, until the end

Return new ModelAndView ("learnDemo/learnDemo/menuListDemo")

The page does not jump properly and always jumps to the error page.

Reason: wrong bag!

Error package:

Import org.springframework.web.portlet.ModelAndView

Correct package:

This is the end of import org.springframework.web.servlet.ModelAndView; 's article on "how to solve the problem that SpringMvc can't jump back to modelandview". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to solve the problem that the page of SpringMvc can not jump back to modelandview". If you want to learn more knowledge, you are welcome to follow the industry information channel.

Tags: Pages problems controls controllers files knowledge errors content articles paths rookies learning configuration slightly careless two code value reasons examples simple operation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Huawei vpn macOS NVidia