How can one set up a Play Framework 404 (OnHandlerNotFound) page in Play 2.2?
frameworks, java, playframework, playframework-2.2, scala
Solution
Create a `views/notFound.scala.html` template to render the HTML page. Then render it like you would a template in any other action.
override def onHandlerNotFound(request: RequestHeader) = {
Future.successful(NotFound(
views.html.notFound()
))
}
Problem
So I've checked around and I've looked at various sources but I've failed to find a way to render a specific page when a handler isn't found. I've gotten to this point in Global.scala: ``` import play.api._ import play.api.mvc._ import play.api.mvc.Results._ import scala.concurrent.Future import views.html._ object Global extends GlobalSettings { override def onHandlerNotFound(request: RequestHeader) = { Future.successful(NotFound( ?? )) } } ``` I'm just unsure what to add at the "??" in that code to render a specific html document when a Handler isn't found. I've tried a few ways but an error always pops up. Thanks.