Play Framework 2.2.1 - Compilation error: "the render method in the class index cannot be applied to the specified types";

I am new to the Play Framework and trying to build a Todo list from this guide.

When I try to start the application, I get an error message:

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

My code (relevant parts):

MainController.java :

final static Form<Task> taskForm = Form.form(Task.class);

public static Result tasks() {
    return ok(
            views.html.index.render(Task.all(), taskForm)
    );
}

index.sacala.html

@(tasks: List[Models.Task], taskForm: Form[Models.Task])

I looked around, the nearest thread that I found was this one, but I could not solve the problem using it (perhaps due to a lack of understanding of the environment / structure ...).


One last thing worth mentioning: If I change index.sacala.html to no parameters (and change "MainController" accordingly, everything will work fine.

.

EDIT:
Task.all():

public static List<Task> all() {
    return new ArrayList<Task>();
}
+4
3

, models NOT models ?

, , :

 @(tasks: List[Task], taskForm: Form[Task])

Hm, ...

[error] /www/play20apps/testing/Todo-List/app/controllers/MainController.java:24: error: method render in class index cannot be applied to given types;
[error]         return ok(views.html.index.render(Task.all(), taskForm));
[error]                                   ^
[error]   required: List<Task>,play.api.data.Form<Task>
[error]   found: List<Task>,play.data.Form<Task>
[error]   reason: actual argument play.data.Form<Task> cannot be converted to play.api.data.Form<Task> by method invocation conversion
[error] 1 error

:

[error]   required: List<Task>,play.api.data.Form<Task>
[error]   found: List<Task>,play.data.Form<Task>

TBH Activator, , play.api.data.Form , Java. - :

@(tasks: java.util.List[Task], taskForm: play.data.Form[Task])

*.api.*, Scala Java, Play 2. +

PostScriptum: , build.sbt play.Project.playScalaSettings play.Project.playJavaSettings, Activator.

+4

, Task.all() Java, scala, , scala.

Task.all(), , :

@(tasks: java.util.List[Models.Task], taskForm: Form[Models.Task])
+2

, biesior- , .
TypeSafe Activator , play comamnd line, .

, .

- , , , .


EDIT:

@biesior , , . , .

+1

All Articles