Open myheavenha opened 1 year ago
spring6移除了对freemaker的jsp支持,所以导致了内置的Request对象用不了,可以在PermissionInterceptor下添加以下代码
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
if (modelAndView != null) {
Map<String, Object> attributes = new HashMap<>();
Enumeration<String> enumeration = request.getAttributeNames();
while (enumeration.hasMoreElements()) {
String key = enumeration.nextElement();
attributes.put(key, request.getAttribute(key));
}
modelAndView.addObject("Request", attributes);
}
}
spring6移除了对freemaker的jsp支持,所以导致了内置的Request对象用不了,可以在PermissionInterceptor下添加以下代码
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if (modelAndView != null) { Map<String, Object> attributes = new HashMap<>(); Enumeration<String> enumeration = request.getAttributeNames(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); attributes.put(key, request.getAttribute(key)); } modelAndView.addObject("Request", attributes); } }
有用。👍🏻