IntelliJ:JSP页面中的Spring MVC bean未解析

时间:2012-04-26 22:59:57

标签: spring jsp spring-mvc intellij-idea

当我在spring mvc中放入模型中的东西时:

@RequestMapping(method = RequestMethod.GET)
public String createForm(Model model) {
    model.addAttribute("item", new Item());
    return "item/new";
}
IntelliJ在相应的JSP页面中没有解析

bean“item”。我的意思是,它完全正常,但自动完成不会:/

在这种情况下有没有办法自动完成?

1 个答案:

答案 0 :(得分:9)

IntelliJ的JSP支持了解一种特殊的注释注释:

<%--@elvariable id="foo" type="com.yourcompany.YourClass"--%>

如果您将此注释放在文件的顶部,则会根据类${foo.

的属性,为com.yourcompany.YourClass开头的表达式提供自动完成功能

如果将鼠标悬停在表达式的foo部分上,IntelliJ还可以创建此注释。