Reputation: 45
I'm attempting to do a reverse lookup on a route I've created. The route is defined as such in my routes file:
POST /login controllers.Web.Application.authenticate
However, when I try to do a reverse on it in a form I made, I can't seem to find it. I'm attempting to do a reverse like this:
@helper.form(action = routes.login())) {
rest of the form here...
}
However, the login appears in red in intellij and when attempting to run the program, I get the following error:
play.sbt.PlayExceptions$CompilationException: Compilation error[value login is not a member of object controllers.routes]
I've attempted recompiling the project multiple times and looking around the docs, but it's just not working... Any ideas?
Upvotes: 0
Views: 850
Reputation: 45
So, an interesting thing happened recently and I found a way to point to the original structure properly. To do so, rather than writing:
routes.Web.Application.authenticate()
As Tyler suggested, I was supposed to write:
Web.routes.Application.authenticate()
Which is totally counter-intuitive and all, but that allows me to use the original package structure.
Upvotes: 3
Reputation: 18187
Edit:
As we discovered in the comments, the reverse router doesn't seem to like sub packages. You should remove the Web
part of your package, and move everything up a level, then change the code to be this:
@helper.form(action = routes.Application.authenticate())) {
rest of the form here...
}
Original answer:
You need to refer to the controller function, and not the name of the route, so it should look something like this:
@helper.form(action = routes.Web.Application.authenticate())) {
rest of the form here...
}
Upvotes: 1