Play framework problem with form

Asked

Viewed 158 times

3

Introducing

I’m starting to develop with the Play Framework. I’m making a TODO list template with it.

Problem

When I am instantiating my form in the controller it returns me the following error:

inserir a descrição da imagem aqui

Would anyone know what the problem is?

Controller ( Application.java )

package controllers;

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

import views.html.*;

import models.*;

public class Application extends Controller {
    static Form<Task> taskForm = form(Task.class);

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

    public static Result tasks() {
        return TODO;
    }

    public static Result newTask() {
        return TODO;
    }

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

}

2 answers

6


Change:

form(Task.class);

To:

Form.form(Task.class);

Or if you prefer, statically import Form methods like this:

import static play.data.Form.*;

And keep using the way you did.

  • 2

    was that right!

1

Place Form.form(Task.class); in place of error.

In this link is an example of a CRUD with master-Detail: Play Crud Master-Detail

Browser other questions tagged

You are not signed in. Login or sign up in order to post.