The Play framework works with a Scala-based templating engine called Twirl. Twirl was inspired by ASP.NET Razor. Twirl is compact and expressive; you will see we can do more with less. Twirl template files are simple text files, however, the Play framework compiles the templates and turns them into Scala classes. You can mix HTML with Scala smoothly in Twirl.
The UI will be compiled into a Scala class, that can and will be referenced at our controllers, because we can route to a view. The nice thing about it is that this makes our coding way safer, since we have the compiler checking for us. The bad news is that you need to compile your UI, otherwise, your controllers won't find it.
Previously in this chapter, we defined controllers for products, images, and reviews, and we wrote the following code:
Ok(views.html.product_details(None, productForm))
With the preceding code, we redirect the user to a blank page for products so that the user can create a new product...