Reputation: 139
I have been running simple hello world app in Play Framework (Java). However, template doesn't recognize my template arguments.
Template(view):
@(userName: String)
@main("Welcome!"){
<h1>Welcome @userName</h1>
}
Controller:
You can see the error line. Also I have compile error which is below :
Upvotes: 0
Views: 43
Reputation: 14401
Let's start from the compilation error because this is the root of of your problems.
In the 3rd line of your main.scala.html
:
@main("Welcome!"){
you're trying to call you main.scala.html
which is incorrect. Your main.scala.html
is trying to call itself recurrently which ends up with the compilation error. Since the template can not be compiled your IDE still shows a previous valid compiled template which takes two parameters. I'm assuming you changed it from the standard Play Java template which looks as follows:
@(title: String)(content: Html)
Changing your main template as shown below should solve your problem.
@(userName: String)
<h1>Welcome @userName</h1>
Upvotes: 3