gpt4 book ai didi

java - Play Framework 文档任务列表示例错误

转载 作者:行者123 更新时间:2023-11-29 03:43:48 25 4
gpt4 key购买 nike

在浏览器中:

Compilation error

error: cannot find symbol
In /home/william/fmj/app/controllers/Application.java at line 28.

24 public static Result deleteTask(Long id) {

25 return TODO;

26 }

27

28 static Form<Task> taskForm = form(Task.class);

29

在终端中:

[error]   static Form<Task> taskForm = form(Task.class);
[error] ^
[error] symbol: class Task
[error] location: class Application
[error] /home/william/fmj/app/controllers/Application.java:16: error: cannot find symbol
[error] views.html.index.render(Task.all(), taskForm)
[error] ^
[error] symbol: variable Task
[error] location: class Application
[error] /home/william/fmj/app/controllers/Application.java:28: error: cannot find symbol
[error] static Form<Task> taskForm = form(Task.class);
[error] ^
[error] symbol: class Task
[error] location: class Application
[error] 3 errors
[error] {file:/home/william/fmj/}fmj/compile:compile: javac returned nonzero exit code

非常感谢任何帮助。我复制并粘贴了教程 (http://www.playframework.org/documentation/2.0.2/JavaTodoList) 的代码,我不确定哪里出了问题,我真的很想学习这项技术!

最佳答案

显然你没有导入 Task模型到你的 Application Controller

您有 3 种解决方案:

  1. 手动导入每个模型:

    import models.Task;
  2. 所有模型完全导入您的 Controller (一开始最好,但是......)

    import models.*
  3. 最推荐:使用一些 知道何时如何导入所需的 IDE packagesclasses并建议您应该导入(或不)(即 IntelliJ Idea - 只是建议)

关于java - Play Framework 文档任务列表示例错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11923269/

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