当我在 spring mvc 中放入模型时,如下所示:
@RequestMapping(method = RequestMethod.GET)
public String createForm(Model model) {
model.addAttribute("item", new Item());
return "item/new";
}
在相应的 JSP 页面中,IntelliJ 不会解析 bean“item”。我的意思是,它工作得很好,但自动完成不会:/
在这种情况下有什么办法可以自动完成吗?
最佳答案
IntelliJ 的 JSP 支持理解一种特殊的注释注释:
<%--@elvariable id="foo" type="com.yourcompany.YourClass"--%>
如果您将此注释放在文件的顶部,idea 将为以
${foo.
开头的表达式提供自动完成功能。基于类 com.yourcompany.YourClass
的属性如果您将鼠标悬停在
foo
上,IntelliJ 还将提供创建此注释的功能。表达式的一部分。
关于spring - IntelliJ : Spring MVC beans in JSP pages are not resolved,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10342586/