Play 框架编译导致"method render in class views cannot be applied to given types"错误



我是Play框架的新手,我正在从控制器传递值到视图。当我在activator中(在命令行中)编译时,我收到以下错误:

[error] C:WebDevgitPlayAuthenticateappcontrollersApplication.java:633: met
hod render in class views.html.profile.profile cannot be applied to given types;
[error]   required: play.data.Form<controllers.Application.ProfileRegister>,java
.util.List<models.Service>
[error]   found: play.data.Form<controllers.Application.ProfileRegister>
[error]   reason: actual and formal argument lists differ in length
[error] profile.render

这是我在控制器中的功能:

public Result addProfile() {
    List<Service> services = Service.find.all();
    return ok(profile.render(form(ProfileRegister.class), services));
}

这是view.html.profile.profile中的第一行:

@(profileForm: Form[Application.ProfileRegister], servicesList: java.util.List[Service])

我不知道我错过了什么。当我删除第二个参数——List对象——它就编译了。

我找到了一些帖子,但它并没有解决我的问题:

Play Framework 2.2.1 -编译错误:"类索引中的方法渲染不能应用于给定的类型;"

编译错误:类列表中的方法render不能应用于给定的类型;

谢谢你的帮助!

看起来Eclipse不喜欢参数之间的空格。我删除了空格,并编译了项目

相关内容

最新更新