What Play is?
Play is a high productivity Java and Scala web application framework that integrates the components and APIs you need to the modern web application. It is a Web framework whose HTTP interface is simple and powerful.
To function correctly, the Play application only needs to include the Play JAR files. Because these JAR files are published to the Maven Repository, you can build a Play project with any Java or Scala build tool.
- Java versions SE 8 through SE 11, inclusive
- sbt – we recommend the latest version
Creating a new application
Open IntelliJ enter the project name and choose the language as Scala and build the system as sbt.
It will take some time to Setup. After Build executes the given command on the terminal.
sbt new playframework/play-scala-seed.g8
It will load all the Dependencies, then It will ask you to provide the project name, organization name, and the version of both Play and Scala Respectively.
As for now, the given details are
Make sure before executing this command you are in the same directory as your project. If it is not then hit the command.
cd /home/knoldus/PlayExample/./startingwithplay where /home/knoldus/PlayExample/./startingwithplay is the path of the template generated by play
The project Structure of the Play framework is a little bit different as shown in the given image.
In our project directory, we see four directories created by the sbt template: app/controllers, app/views, conf, and public.
- The controllers directory is where we will store our Scala code
- The views directory is where we’ll save our HTML templates
- The conf directory contains our router configuration which maps a request URL to a specific class and method
- Finally, the public directory contains the static content served by the Play Framework server
for more updates please visit https://blog.knoldus.com/