我试图在thymeleaf 3.0.3和Spring Boot 1.5.1的模板中调用Web上下文对象上的方法,例如#request和#response.
我不断收到这样的错误:
org.springframework.expression.spel.SpelEvaluationException:EL1011E:方法调用:尝试在空上下文对象上调用方法method(java.lang.String)
这是一个控制器:
@Controller
public class Controller {
@RequestMapping(method = RequestMethod.GET, value = "/endpoint", produces = "text/html")
public String customerServiceSignin(Model uiModel, HttpServletRequest request) {
uiModel.addAttribute("attr1", true); // show proper header
uiModel.addAttribute("attr2", false);
return "template";
}
和一个模板:
| User: | |
| Password: | |
这是一个示例,但是在任何尝试执行此操作的地方都会出现这些错误.我有没有想念的东西吗?
在Thymeleaf3.0.3模板和SpringBoot1.5.1的结合使用中,遇到尝试调用#request和#response方法时抛出SpelEvaluationException错误。问题出现在试图在空上下文对象上执行方法。已提供了一个Controller和模板代码示例,但无论何处尝试调用这些方法都会失败。目前尚不清楚解决方案。
274

被折叠的 条评论
为什么被折叠?



