Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play framework form issues

i am doing the example on http://www.playframework.org/documentation/2.0.4/JavaTodoList but i have problem with the form. If you look under the "The task form" section you will see that i am asked to add static Form taskForm = form(Task.class); to the Application controller.

The problem i am getting is "The method form(Class) is undefined for the type Application"

I am running play-2.1-RC1 instead of play-2.0.4 (play-2.0.4 is the one talked about in the example)

This is the compilation error i got

[info] Compiling 4 Scala sources and 2 Java sources to /Users/johnnybekkestad/Documents/workspace/play/todolist/target/scala-2.10/classes...
[error] /Users/johnnybekkestad/Documents/workspace/play/todolist/app/controllers/Application.java:12: error: cannot find symbol
[error]     static Form<Task> taskForm = form(Task.class);
[error]                                  ^
[error]   symbol:   method form(Class<Task>)
[error]   location: class Application
[error] 1 error
[error] (compile:compile) javac returned nonzero exit code
[error] application -

! @6d1acongn - Internal server error, for (GET) [/] ->

sbt.PlayExceptions$CompilationException: Compilation error[error: cannot find symbol]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15$$anonfun$apply$16.apply(PlayReloader.scala:322) ~[na:na]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15$$anonfun$apply$16.apply(PlayReloader.scala:322) ~[na:na]
    at scala.Option.map(Option.scala:133) ~[scala-library.jar:na]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15.apply(PlayReloader.scala:322) ~[na:na]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15.apply(PlayReloader.scala:319) ~[na:na]
    at scala.Option.map(Option.scala:133) ~[scala-library.jar:na]
like image 278
Beau Johnny Bekkestad Avatar asked Jan 10 '13 09:01

Beau Johnny Bekkestad


1 Answers

change line:

form(Task.class);

for:

Form.form(Task.class);

And of course you have to add:

import views.html.*; 
like image 71
Marcin Sokolowski Avatar answered Sep 18 '22 17:09

Marcin Sokolowski