O'Reilly logo

Play Framework Essentials by Julien Richard-Foy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating HTML forms

The two routes of our application using the GET verb (Items.list and Items.details) now return an HTML page. However, the remaining routes are not currently reachable by our web users. Web browsers can perform POST requests only when an HTML form is submitted or if some client-side code sends an XmlHTTPRequest.

Let's add an HTML page that contains a form to create new items, which will look like the following:

Generating HTML forms

First, we need to define an HTTP endpoint for the page containing the form and then write the according route:

GET     /items/add     controllers.Items.createForm

Note

Note that as routes are tried in their definition order, this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required