【发布时间】:2013-11-20 05:09:48
【问题描述】:
您好,我是 Play Framework 的新手,到现在为止的体验真的很糟糕。我观看或做的每个教程都会遇到一些无法修复的愚蠢错误。我离离开这个游戏框架只有一步之遥。无论如何,这是我得到的最后一个错误:
如果我去 localhost:9000/example 我得到这个错误
未找到操作 对于请求 'GET /example' 已按以下顺序尝试了这些路线:
1GET/controllers.Application.index()
2GET/example/controllers.Application.example()
3GET/assets/$file<.+>controllers.Assets.at(path:String = "/public", file:String)
我的 Application.java 看起来像这样:
package controllers;
import play.*;
import play.mvc.*;
import views.html.*;
public class Application extends Controller {
public static Result index() {
return ok(index.render("Play Tutorial :)"));
}
public static Result example(){
String s = "Hello Mr View";
return ok(fun.render(s));
}
}
这是我的路线文件:
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.index()
GET /example/ controllers.Application.example()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
这是我的 fun.scala.html 文件:
@(message: String)
<h1>@message</h1>
我在本教程中这样做: http://www.youtube.com/watch?v=mST2YmQYgS8&list=PL177265F762D05F72
【问题讨论】: