Harlin
Harlin

Reputation: 1149

play framework Form.form cannot find symbol

I am going through the Play Framework tutorial. I am getting this error:

error: cannot find symbol

In /Users/hseritt/devel/todolist/app/controllers/Application.java at line 12.

import views.html.*;

public class Application extends Controller {

static Form<Task> taskForm = Form.form(Task.class); // ERROR IS HIGHLIGHTED AS Form.form 

public static Result index() {
    return redirect(routes.Application.tasks());
}

My full code for Application.java:

package controllers;

import play.*;
import play.data.*;
import play.mvc.*;

import models.*;
import views.html.*;

public class Application extends Controller {

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

public static Result index() {
        return redirect(routes.Application.tasks());
}

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

public static Result newTask() {
     return TODO;
}

public static Result deleteTask(Long id) {
    return TODO;
}
}

I am wondering if I missed something in the tutorial or put something in the wrong place.

Thanks!

Upvotes: 4

Views: 6983

Answers (2)

Brian Chi Zhang
Brian Chi Zhang

Reputation: 1

As per jnoob, just change import to import play.data.Form, then do static Form<Task> taskForm = form(Task.class);, worked for me.

Upvotes: 0

adis
adis

Reputation: 5951

I think you should import the following:

import static play.data.Form.*;

Upvotes: 1

Related Questions