I've just created a new play framework project and it runs fine. Now, once I modify my routes file (all I'm doing is adding the GET /popular
line):
# Home page
GET /popular controllers.Application.popular()
GET / controllers.Application.index()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
Now in my controller, I add the handler:
public class Application extends Controller {
public static Result index() {
return ok(index.render("Your new application is ready."));
}
public static Result popular() {
ArrayList<String> popular = new ArrayList<String>();
popular.add("testing");
popular.add("123");
return ok(Json.toJson(popular));
}
}
For some reason, I'm getting a 'Action not found' when trying to access http://127.0.0.1:9000/popular
.
I just wanted to try out a simple action. Any idea why I'm getting this error?
Apparently going into the play console and executing a clean
command fixes this. If this doesn't work, try also manually executing a compile
command.
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