当我在spring mvc中放入模型中的东西时:
@RequestMapping(method = RequestMethod.GET)
public String createForm(Model model) {
model.addAttribute("item", new Item());
return "item/new";
}
IntelliJ在相应的JSP页面中没有解析bean“item”。我的意思是,它完全正常,但自动完成不会:/
在这种情况下有没有办法自动完成?
答案 0 :(得分:9)
IntelliJ的JSP支持了解一种特殊的注释注释:
<%--@elvariable id="foo" type="com.yourcompany.YourClass"--%>
如果您将此注释放在文件的顶部,则会根据类${foo.
com.yourcompany.YourClass
开头的表达式提供自动完成功能
如果将鼠标悬停在表达式的foo
部分上,IntelliJ还可以创建此注释。