Mike Mitterer
Mike Mitterer

Reputation: 7180

Update view params in Java class / play2

I am new to Play Framework 2.0. I am playing around with the helloworld sample. I experienced the following problem:

View: (test.scala.html)

@(name: String,lastname:String)
...

Controller: (Test.java)

...
public static Result index() {
   return ok(test.render("First", "Last"));
}

Works so far. BUT if I change the view to:

@(name: String)  @* removed second param *@

and the controller to:

...
public static Result index() {
   return ok(test.render("First"));
} 

Eclipse show an error in Test.java (controller) The funny thing is that play compiles everything just fine. The rendering works - only eclipse is acting up.

The only way to solve this problem is to modify the view slightly, delete the generated class-files in target/scala-2.9.1/classes_managed/views/html/test.* Now play compiles and generates the test*.class files and everything works.

But I am sure there is a better way...

thx in advance

Upvotes: 2

Views: 217

Answers (1)

Daniel C. Sobral
Daniel C. Sobral

Reputation: 297265

The class for the view is not modified until you load it in the web browser. Until then, Eclipse has no way of knowing the controller is now valid.

Upvotes: 1

Related Questions