The accepted answer is right, but it doesn't cover the case where the controller is in a sub-package, i.e.: controllers.applications.MyFavouriteApplication.show()
Since I had a hard time finding the answer, I'll post it here.
To put a non-scoped link into a template, the proper pattern is @controllers.{sub-packages if any}.routes.{your class}.{your method}()
So in this case it would be @controllers.applications.routes.MyFavouriteApplication.show()
IF you were using the recommended Play pattern of using @Inject
to create singleton controller objects, and IF you thought the correct answer was @controllers.applications.MyFavouriteApplication.show()
, you would get an error like this:
Object MyFavouriteApplication is not a member of controllers.applications. Note: class MyFavouriteApplication exists, but it has no companion object.
Given that you had already supplied the @Inject()
@Singleton
annotation, this would seem like a very strange error indeed. It might make you question if you were building the project correctly. Determining the true cause could cost you considerably in blood and treasure.
com.mycompany.myproduct.controllers.LoginController.index()
– Reisfield