一般设置在spring-servlet.xml里面设置
<!-- 对转向页面的路径解析。prefix:前缀, suffix:后缀 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
@RequestMapping(value="/appAuthCallBack")
public String redirect(HttpServletRequest request,HttpSession session, ModelMap model){
String authCode=request.getParameter("auth_code");
LoggerUtil.info(logger, "回调入参:{0}", authCode);
Map<String, String> map=payservice.getAccessToken(authCode);//获取accessToken
session.setAttribute("accessToken", map.get("accessToken"));
session.setAttribute("userId", map.get("userId"));
LoggerUtil.info(logger, "获取map的值:{0}", map);
model.addAttribute("userId", map.get("userId"));
model.addAttribute("accessToken", map.get("accessToken"));
return "showtoken.vm";
}
设置生效时不管返回前缀后缀是什么都会加上路径前缀和后缀