404

A list of Play Framework controller action results (result types)

When you’re writing Play Framework controller actions, you’re typically going to be returning a Play Results, with the most common result being Ok. However, your controller actions can return many different result types. This table shows some of the most common result types that you can use instead of Ok:

How to handle Scala Play Framework 2 404 and 500 errors

To handle 404 and 500 errors in the Scala Play Framework 2, you need to create a Global.scala object in your main app directory. The object should extend GlobalSettings, and override the necessary methods.

The following example Play Framework Global object, saved as app/Global.scala, demonstrates this: