[JAVA] Form --FormFactory --DynamicForm

Form --FormFactory --What's different about Dynamic Form?

The three forms are to submit HTTP form data. First, in the play.data package of the Java Play framework

java.lang.Object
   play.data.Form<DynamicForm.Dynamic>
     play.data.DynamicForm
java.lang.Object
     play.data.FormFactory

An easy way to submit a form is to wrap an existing class First, the model class is

public class User {
    public String email;
    public String password;
}

To wrap a class

Form<User> userForm = Form.form(User.class); //Java play 2.Use for 4x or less
Form<User> userForm = formFactory.form(User.class); //Java play 2.Use for 5 or more

When binding the content of the request directly

User requestData = userForm.bindFromRequest().get();   //2.less than 4
User requestData = formFactory.form(User.class).bindFromRequest(); //2.5 or more

When retrieving data from a request that is not related to the model:

DynamicForm requestData = Form.form().bindFromRequest(); //2.less than 4

DynamicForm requestData = formFactory.form().bindFromRequest();//2.5 or more

Recommended Posts

Form --FormFactory --DynamicForm
From (form)