SpringMvc的服务器端跳转和客户端跳转

首先,找到

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:”即可

posted @ 2017-02-26 11:17  左正  阅读(675)  评论(0编辑  收藏  举报