Reverse Nested Routes in Play Framework 2.0

How to use reverse routing with a sub-packaged controller.

// app/controllers/example/MyController.scala

package controllers.example

import play.api.mvc._

object MyController extends Controller {
  def helloWorld = Action {
    Ok(views.html.example.helloWorld)
  }
}
// conf/routes

GET /example/  controllers.example.MyController.helloWorld()

In the template, note the fully qualified name of the route:

// app/views/example/helloWorld.scala.html

<p>Hello World</p>
<a href="@controllers.example.routes.MyController.helloWorld()">Link to this page</a>

Follow the discussion on routes for controller sub-packages on the play-framework google group.