controller « playframework « Java Enterprise Q&A

1. How do Play controllers inject variables with the proper name into templates?

In the Play getting started docs, they show this controller:

public static void index() {
  Post frontPost = Post.find("order by postedAt desc").first();
  List<Post> olderPosts = Post.find("order by postedAt ...

2. Is it possible to embed controllers with Play Framework?

I have two forms, each with their own actions. Then I have a page which is supposed to embed these two forms in a single page. Is it possible to embed/include other ...

3. Play Framework messages in controller

How can I access a value from the "messages" file in a controller? For example, in my "messages" file: = Play Framework App
How can I get the value of ...

4. Calling static methods in Play! framework controller doesn't work

I have a Play! framework with two actions which contain redundant code. So I factored this code into a private static method, but It doesn't work anymore then.

  public static ...

5. Call a controller method within Play! template

How can I call a controller method from within a Play! template? I have a default controller, Application, and the hasliked() method inside that controller. The method returns whether the logged in user ...

6. Do multiple @Before methods work in Controller inheritance?

I'm trying something similar to this, and only one of the @Before methods gets called:

public abstract class ControllerBase extends Controller {
  static void foo() {