2016-11-15 59 views
0

我是Play Framework的新手,并且正在将值从控制器传递到视图。当我在激活编译(命令行),我收到此错误:Play Framework编译原因“类视图中的方法呈现无法应用于给定类型”错误

[error] C:\WebDev\git\PlayAuthenticate\app\controllers\Application.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 - Compilation error: "method render in class index cannot be applied to given types;"

Compilation error: method render in class list cannot be applied to given types;

感谢您的帮助!

回答

0

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

相关问题