Learn Java for Web Development
CHAPTER 8: Play with Java and Scala 359 Now enter the following command in the command-line tool to check whether the Play envir ...
360 CHAPTER 8: Play with Java and Scala You can also get some help by executing the help command, as illustrated in Figure 8-4. ...
CHAPTER 8: Play with Java and Scala 361 You have to specify 2 because you want to create a Java application. Specifying 2 create ...
362 CHAPTER 8: Play with Java and Scala Now type run. This will start the server that will run your application. $ run The outpu ...
CHAPTER 8: Play with Java and Scala 363 Figure 8-9 illustrates the default Play 2 welcome page. The default welcome page of the ...
364 CHAPTER 8: Play with Java and Scala target: The target directory contains everything generated by the build system such ...
CHAPTER 8: Play with Java and Scala 365 import views.html.*; public class Application extends Controller { public stati ...
366 CHAPTER 8: Play with Java and Scala For importing the project, select File ➤ Import, select General ➤ Existing Projects into ...
CHAPTER 8: Play with Java and Scala 367 Figure 8-13. Importing the project Now browse your filesystem, select the project folder ...
368 CHAPTER 8: Play with Java and Scala All the files necessary to configure an Eclipse project are generated. You saw how to cr ...
CHAPTER 8: Play with Java and Scala 369 Play 2 provides some sample applications in the samples folder in play-2.2.0\samples\jav ...
370 CHAPTER 8: Play with Java and Scala You can go through the code on your own and improve the application. Helloworld Scala Ap ...
CHAPTER 8: Play with Java and Scala 371 Now you can run the helloworld-scala project using the run command from the Play console ...
372 CHAPTER 8: Play with Java and Scala Listing 8-5. Template in helloworld-scala @(message: String) @main("Welcome to Play") ...
CHAPTER 8: Play with Java and Scala 373 To import the project, you can just repeat the same steps you performed earlier when gen ...
374 CHAPTER 8: Play with Java and Scala Play cannot compile your routes file because it references actions that don’t exist. The ...
CHAPTER 8: Play with Java and Scala 375 public static Result newBook() { return TODO; } public static Result deleteBook(Long ...
376 CHAPTER 8: Play with Java and Scala } public static void create(Book book) { } public static void delete(Long id) { } } ...
CHAPTER 8: Play with Java and Scala 377 Listing 8-11. Simple Template @(books: List[Book]) @for(book ...
378 CHAPTER 8: Play with Java and Scala In Listing 8-12, the template takes two parameters. @content is a parameter that represe ...
«
14
15
16
17
18
19
20
21
22
23
»
Free download pdf