0

I am new to Scala Play Framework. In my routes I have mentioned my the url to all my static resources. Here is the code for it.

GET    /public/*file    controllers.Assets.at(path="/public/", file)

My application context is /api/dashboard/v2.2. I have a public folder in the root of my project. There is an html page called default.htm. Now I want to see the html page in the browser.

In the url I am typing http://localhost:9000/api/dashboard/v2.2/public/default.htm. It is giving me 404 Not Found error. The call to the methods of the controller are working fine. But whenever I am trying to call the static resources I am getting this error.

4

2 回答 2

1

尝试

http://localhost:9000/public/default.htm

页面位置在哪里

Project-->public--->default.htm
于 2015-04-01T12:42:07.770 回答
1

在位于 conf/route 的路由文件中创建一个路由

添加路由默认路由。

GET          /yoururl              controllers.Application.default

将文件移动到视图文件夹并将其另存为default.scala.html.

在您的控制器文件夹中创建一个控制器应用程序控制器。

import play.api.mvc._
object Application extends Controller {

  def default = Action {
    Ok("views.html.default()")
  }

}

在浏览器中输入"http://localhost:9000/yoururl" 它将呈现您的默认 HTML 页面。

于 2015-04-01T13:00:26.937 回答