Skip to content

Instantly share code, notes, and snippets.

@chkal
Created December 11, 2014 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chkal/659854a1a99d1ea4afb3 to your computer and use it in GitHub Desktop.
Save chkal/659854a1a99d1ea4afb3 to your computer and use it in GitHub Desktop.
@Controller
@Path("/somepage")
public class SomeController {
@Inject
private Result result;
@Inject
private Validator validation;
@Get
public void renderPage() {
result.include("foo", "Something to include on the page");
result.include("bar", "More stuff to include on the page");
}
@Post
public void processForm(@NotNull @Valid Form form) {
validation.onErrorForwardTo(this).renderPage();
// validation has passed, perform business logic here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment