将控制器中的List <string>传递给Scala / Play Framework中的视图

时间:2016-11-17 21:17:24

标签: scala playframework

我正在尝试将List对象从控制器传递到Scala / Play Framework中的视图。

我无法获得编译的视图(html)。它不喜欢我的视图集 - 它给了我这个错误:

[error] C:\WebDev\git\PlayAuthenticate\app\views\profile\editprofile.scala.html:
130: Expected ')' but found 'EOF'
[error] }
[error]  ^
[error] (compile:twirlCompileTemplates) Twirl compilation failed

以下是视图中的第一行代码:

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

我猜测servicesSelected: List[String]不正确。

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

public Result openProfile(String name) {
    Form<ProfileRegister> profileEntry = form(ProfileRegister.class).bindFromRequest();
    List<Service> services = Service.find.all();
    // Find profile and display...
    Profile profile = Profile.findByName(name);
    // Grab the current services...
    String currentServices = profile.services;
    List<String> selectedServices = new ArrayList<String>(Arrays.asList(currentServices.split(",")));
    return ok(showprofile.render(profileEntry, services, profile, selectedServices));
}

我很感激帮助!

0 个答案:

没有答案
相关问题