Learn Java for Web Development

(Tina Meador) #1

374 CHAPTER 8: Play with Java and Scala


Play cannot compile your routes file because it references actions that don’t exist. The next step is
to add these actions to the Application.java file.


Creating the Controller and Actions

In this section, you will create the actions, as illustrated in Listing 8-8.


Listing 8-8. Application Controller in the Books Application



  1. public class Application extends Controller {



  2. public static Result index() {

  3. return ok(index.render("Your new application is ready."));

  4. }



  5. public static Result books() {

  6. return TODO;

  7. }




Figure 8-21. Routes file compilation error

Free download pdf