Last active
August 29, 2015 14:03
-
-
Save zh32/4361a38c22ba04ff74f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Application extends Controller { | |
static Form<TestData> form = Form.form(TestData.class); | |
public static Result index() { | |
return ok(index.render(form)); | |
} | |
public static Result submit() { | |
Form<TestData> filledForm = form.bindFromRequest(); //bindFromRequest returns "a copy of this form filled with the new data" | |
if (filledForm.hasErrors()) { | |
Logger.error("YES YOU HAVE ERRORS"); | |
return badRequest(index.render(filledForm)); //show the form with the data | |
} | |
Logger.debug("Age:"+testData.age); | |
return ok(index.render(form)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll need to do:
After the if statement.