Play framework 2.0 reverse routing

I am new to Java and I am using the play 2.0 platform for the project and I was wondering how to use the reverse routing function. We have the following:

In the routes file

GET /                controllers.Application.index()
GET /myapp/storage   controllers.myapp.AnotherController.index()

So, to use reverse routing:

controllers.routes.ref.Application.index() 

but what about AnotherController?

If I use controllers.routes.ref.AnotherController.index()in the test, the playback environment will cause an error "cannot find character".

Thank.

+5
source share
2 answers

Try to drop the item ref. I use the following structure for return routes in my play-2.0.4 application:

<full-package-name>.routes.<controller>.<action>

So the return path to your second action would be this:

controllers.myapp.routes.AnotherController.index()

, , , :

controllers.myapp.routes.AnotherController.index
+11

. , :

activator clean
activator run
+1

All Articles