O'Reilly logo

Play Framework Cookbook - Second Edition by Giancarlo Inductivo, Alexander Reelsen

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

Using path binders

For this recipe, we will explore how Play applications allow us to use custom binders for path parameters. These come in handy when you want to simplify your declaration of routes and corresponding actions by dealing with model classes in the routes file and a method signature of actions instead of individual properties and fields declared as parameters.

How to do it…

For Java, we need to take the following steps:

  1. Run the foo_java application with Hot-Reloading enabled.
  2. Create a new products controller as foo_java/app/controllers/Products.scala. Once created, add a product case class and companion object, the product form object, and two routes (the first to display our selected product in a form and the second as the PUT action ...

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