java 播放框架路线不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16705203/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Play Framework Routes not working
提问by Bert B.
I am just trying to follow along with the ZenTasks tutorial (http://www.playframework.com/documentation/2.1.0/JavaGuide4) for the Play Framework. I can't seem to even get the Login page to work however.
我只是想遵循Play 框架的 ZenTasks 教程 ( http://www.playframework.com/documentation/2.1.0/JavaGuide4)。但是,我似乎甚至无法使登录页面正常工作。
I am running this project with the play ~run
command. When navigating to http://localhost:9000/login
the error is
我正在使用play ~run
命令运行这个项目。当导航到http://localhost:9000/login
错误是
Action not found For request 'GET /login'
These routes have been tried, in this order:
1 GET/controllers.Application.index()
2 GET/assets/$file<.+>controllers.Assets.at(path:String = "/public", file:String)`
My routes file looks like
我的路线文件看起来像
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.index()
# User athentication
GET /login controllers.Application.login()
POST /login controllers.Application.authenticate()
GET /logout controllers.Application.logout()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
and the Application.login, authenticate, and logout functions all compile properly. Am I missing something incredibly easy here, because I can't tell what is going wrong?
并且 Application.login、authenticate 和 logout 函数都编译正确。我是否在这里遗漏了一些非常简单的东西,因为我不知道出了什么问题?
回答by Tapan Chandra
Looks like the routes file wasn't compiled properly. probably, you should do a clean in the play console and try again
看起来路由文件没有正确编译。可能,您应该在游戏控制台中进行清理,然后再试一次
$ play clean-all
回答by tebesfinwo
@DiAlex
@迪亚历克斯
Just in case play clean-all
doesn't work, you can try to
以防万一play clean-all
不起作用,您可以尝试
$ clean
then
然后
$ compile
within the play console.
在游戏控制台内。
However, I think both of them do the same thing.
但是,我认为他们都在做同样的事情。
回答by Alex Fruzenshtein
If you are using play framework via Activator you can simply do the follow steps:
如果您通过 Activator 使用播放框架,您只需执行以下步骤:
- sbt clean
- activator run
- sbt 干净
- 活化剂运行