Ömer ASLAN
Ömer ASLAN

Reputation: 139

Play framework template didn't syncronized and didn't recognized by eclipse

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:

enter image description here

You can see the error line. Also I have compile error which is below :

enter image description here

Upvotes: 0

Views: 43

Answers (1)

Daniel Olszewski
Daniel Olszewski

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

Related Questions