"the method form(class<t>) from form class is deprecated in play! framework" Code Answer

1

the play 2.5.x documentation states it:

to wrap a class you have to inject a play.data.formfactory into your controller which then allows you to create the form:

form userform = formfactory.form(user.class);

so the first step is to inject the formfactory into your controller. you do it like this:

package controllers;

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

public class application extends controller {

    @inject formfactory formfactory;

    ...
}

then in the action where you handle the form-submission request you can use the formfactory like this:

public result handleformsubmission() {
    formfactory.form(director.class).bindfromrequest();
}
By Franck on May 13 2022

Answers related to “the method form(class<t>) from form class is deprecated in play! framework”

Only authorized users can answer the Search term. Please sign in first, or register a free account.