Method 1: The configuration file modifies the redirectHttp10Compatible property of ViewResolver, which is to be compatible with the http1.0 protocol.
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/" /> <property name="suffix" value=".jsp" /> <property name="redirectHttp10Compatible" value="false" /> </bean>
Method 2: Instead of using return "redirect:/xxx" directly in the code, use
modelAndView.setView(new RedirectView("your redirect URL",true,false));
This is the interface document of RedirectView