首先,找到

package org.springframework.web.servlet.view;

public class InternalResourceViewResolver extends UrlBasedViewResolver

UrlBasedViewResolver这个类

 

/**
* Prefix for special view names that specify a redirect URL (usually
* to a controller after a form has been submitted and processed).
* Such view names will not be resolved in the configured default
* way but rather be treated as special shortcut.
*/
public static final String REDIRECT_URL_PREFIX = "redirect:";


/**
* Prefix for special view names that specify a forward URL (usually
* to a controller after a form has been submitted and processed).
* Such view names will not be resolved in the configured default
* way but rather be treated as special shortcut.
*/
public static final String FORWARD_URL_PREFIX = "forward:";

 

会有这俩个属性

 

默认情况下是服务器端跳转,在需要客户端跳转的时候加上“redirect:”即可

相关文章:

  • 2021-12-26
  • 2021-10-22
  • 2022-02-26
  • 2022-12-23
  • 2021-12-04
  • 2021-04-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-18
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案