Suave Nti
Suave Nti

Reputation: 3757

Scala templates in Playframework2

Have have tried earlier with Play1.2.3 ..I so loved the framework.

Now am trying to start a web application for this I wanted to give a try with Play2.0.2 (Latest).

Downloaded Play2.0.2 Java version ..

*Play new myFirstApp >>  play run >> Done as expected.* (Selected a simple Java app option 2  )

Had a closer look at the html files inside views

index.scala & main.scala Why ?

Later have opened the index.scala html file Have found this :

 @(message: String)

 @main("Welcome to Play 2.0") {

   @play20.welcome(message, style = "Java")

 }

Unable to understand the above template code?

Do I need to have scala knowledge to get along with future Playframework versions?

Upvotes: 0

Views: 254

Answers (1)

biesior
biesior

Reputation: 55798

Yes, you need a little Scala knowledge, but in range required in templates that, what you can find in the docs will be enough.

index.scala.html is a template only for this one page, main.scala.html is a layout it's similar to

Template decorators : #{extends /} and #{doLayout /} from 1.2.x (scroll to that section)

Beside this you can create your controllers and models in pure Java, see samples included to the Play 2 sources, you will get it in short time, can ensure you.

Upvotes: 2

Related Questions