I have these 2 methods in my contoller:
public static void index() {
List<Tweet> tweets = Tweet.findLatest();
render(Template("index.html").params(tweets).render());
}
public static void create(String tweet) {
Tweet t = new Tweet();
t.tweet = tweet;
t.save();
render(Template("index.html").params(t).render());
}
Now the routes is shouting at me saying "Cannot use a method returning Unit as an Handler". My route file has this default route defined in it:
GET / controllers.Application.index()
what could be the possible reason ?
Raul, each action of the controller is expected to be static and to return Result
public static Result index() {
List<Tweet> tweets = Tweet.findLatest();
return ok(Template("index.html").params(tweets).render());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With