【发布时间】:2023-03-05 00:36:01
【问题描述】:
可能重复:
How to make Eclipse see the changes in Play! compiled templates?
我正在为 Play 迈出第一步!框架和我遇到了一些问题。 我可以毫无问题地创建和制作项目。
现在,如果我添加一个新视图,例如“sometest.scala.html”并尝试在“应用程序”中使用它,Eclipse 会将此文件标记为错误。
package controllers;
import play.*;
import play.mvc.*;
import views.html.*;;
public class Application extends Controller {
public static Result index() {
return ok(sometest.render("test")); // this line is marked red
}
}
Eclipse 会标记一些红色,即使它可以工作。如果我转到 localhost:9000,我可以看到我的更改。
我的视图文件夹如下所示:
app
--views
----index.scala.html
----main.scala.html
----sometest.scala.html
我将 sometest 创建为 html 文件并将文件名设置为 .scala.html
简单的解决方案:
运行您的应用程序
$ cd myapp
$ play
$ run
转到您的 webrwoser 并输入:localhost:9000
在您的视图文件夹中创建一个新的 .scala.html 文件。
在 localhost:9000 刷新您的网站
完成。
【问题讨论】:
标签: java eclipse playframework-2.0