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:
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 ...
Get Play Framework Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.