gpt4 book ai didi

java - Playframework - Eclipse 无法检测到新模板

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:34:57 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
How to make Eclipse see the changes in Play! compiled templates?

我正在尝试使用 Play 迈出第一步!框架,我遇到了一些问题。我可以毫无问题地创建和使项目黯然失色。

现在,如果我添加一个新 View ,例如“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,我可以看到我的更改。

我的 View 文件夹如下所示:

app
--views
----index.scala.html
----main.scala.html
----sometest.scala.html

我将 sometest 创建为 html 文件并将文件名设置为 .scala.html

简单的解决方案:

运行您的应用程序

$ cd myapp
$ play
$ run

转到您的 webrwoser 并输入:localhost:9000

在您的 View 文件夹中创建一个新的 .scala.html 文件。

在 localhost:9000 刷新您的网站

完成。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com