【发布时间】:2018-06-22 21:09:30
【问题描述】:
我正在尝试帮助其他开发人员解决此问题,但我似乎无法解决此问题。我正在编译一个 Play 应用程序,但我不断收到此错误:
C:\myapp\app\views\index.scala.html:1: type Index is not a member of object controllers.Application
[error] @(indexForm: Form[Application.Index])
我已经查看了我编写的其他应用程序,但找不到解决方案。
这里是控制器:
public class Application extends Controller {
public class Index {
public String name;
public String title;
}
public Result index() {
// Open the index page...
return ok(index.render(form(Index.class)));
}
...
}
这里是视图:
@(indexForm: Form[Application.Index])
@main(null) {
<section id="homePage">
<div class="container">
<h3><b>Here is your index page</b></h3>
<div class="testimonials">
<div class="item">
<div class="testim_content">You can customize this as your landing page</div>
</div>
</div>
<div class="container">
<div class="row" style="margin: auto;">
<div class="col-sm-3">
<a href="/add$$APPNAME$$" class="buttonCustomView" style="color: #FFFFFF;">Add New " + mainTable + "</a>
</div>
<div class="col-sm-3">
<a href="/view$$APPNAME$$" class="buttonCustomView" style="color: #FFFFFF;">View All " + mainTable + "</a>
</div>
<div class="col-sm-3">
<a href="/login" class="buttonCustomView" style="color: #FFFFFF;">Login</a>
</div>
</div>
</div>
</div>
</section>
}
我一直在查看这些帖子:
Play Framework - value login is not a member of controllers.Application
Play Framework For Scala: Compilation error[type Application is not a member of package controllers]
我已经尝试重命名类,但仍然没有成功。
我知道这可能是一个简单的答案,但我不知道它是什么。
感谢您的帮助。
【问题讨论】:
标签: java playframework