Play Scala Application "not found: value action"

I follow the instructions in the article http://scala.playframework.org/documentation/scala-0.9.1/hello-world

I installed Specafe Stack 1.1 and Play! Framework 2.0 beta.

When I change the index.scala.html file to

@(message: String) @main("Welcome to Play 2.0 beta") { <form action="@action(controllers.Application.index)" method="GET"> <input type="text" name="myName" /> <input type="submit" value="Say hello!" /> </form> } 

the page will not compile with the error message not found: value action . I decided that it also does not compile with other helpers. I googled for a solution and came up with nothing. I am completely new to Scala and will be grateful for any help.

+4
source share
1 answer

I just started playing with the game and scala I found that game 2.0 is not something one should start with.

It seems that the game lacks 2.0, and most of the lessons for playing 1.x. For example, I lost time with the eclipify game to find in the error archive that such β€œcomfort” was not implemented in game 2.0. Therefore, I would advise you to learn scala with game 1.

And in your step in the tutorial (tutorial for game 1, I don't know, for game 2) you have to change:

 controllers.Application.index to controllers.Application.sayHello 

add to contollers.scala

 def sayHello = html.sayHello(params.get("myName")) 

Add this file helloworld/app/views/Application/sayHello.scala.html:

 @(name:String) @main(title = "Hello") { <h1>Hello @(name ?: "Guest")!</h1> <a href="@action(controllers.Application.index)">Back to form</a> } 
+4
source

Source: https://habr.com/ru/post/1382769/


All Articles