Learn Java for Web Development

(Tina Meador) #1

372 CHAPTER 8: Play with Java and Scala


Listing 8-5. Template in helloworld-scala



  1. @(message: String)



  2. @main("Welcome to Play") {



  3. @play20.welcome(message)



  4. }


As you can notice, the template in helloworld and helloworld-scala are the same except for line 5.
The Scala version is not initializing the style argument because its default value is Scala.


Configuring Eclipse for Scala

You can use the Scala IDE for Scala-based applications. The Scala IDE is an Eclipse plug-in,
and you can install this plug-in by selecting Help ➤ Install New Software. In the “Work with”
field, enter the path for the plug-in (http://scala-ide.org/download/current.html), as shown in
Figure 8 -2 0. You can also find detailed instructions for configuring Eclipse for Scala at
http://scala-ide.org/documentation.html.


Figure 8-20. Installing the Eclipse plug-in for the Scala IDE

Free download pdf