jsp引入方式

1.按接口引入
<jsp:include page="/public/base/top"></jsp:include>

@RequestMapping(value="/public/base/top")
	public String baseTop(Model model,HttpServletRequest request){
		LoginResult loginResult=getCacheUser(request);
		if(StringUtils.isEmpty(loginResult)){
			return "redirect:/login";
		}
		if(StringUtils.isEmpty(loginResult.getUserId()) || StringUtils.isEmpty(loginResult.getToken())){
			return "redirect:/login";
		}
		model.addAttribute("userId", loginResult.getUserId());
		model.addAttribute("userName", loginResult.getUserName());
		return "base/top";
	}
2.按文件引入
<jsp:include page="/WEB-INF/view/base/top.jsp"></jsp:include>

你可能感兴趣的:(java)