Welcome to Play
Congratulations, you’ve just created a new Play application. This page will help you with the next few steps.
You’re using Play 2.6.11
Why do you see this page?
The conf/routes
file defines a route that tells Play to invoke the HomeController.index
action
whenever a browser requests the /
URI using the GET method:
# Home page
GET / controllers.HomeController.index
Play has invoked the controllers.HomeController.index
method to obtain the Action
to execute:
def index = Action { implicit request: Request[AnyContent] =>
Ok(views.html.index("Your new application is ready!"))
}
An action is a function that handles the incoming HTTP request, and returns the HTTP result to send back to the web client.
Here we send a 200 OK
response, using a template to fill its content.
The template is defined in the app/views/index.scala.html
file and compiled as a Scala function.
@(message: String)
@main("Welcome to Play") {
@welcome(message)
}
The first line of the template defines the function signature. Here it just takes a single String
parameter.
This template then calls another function defined in app/views/main.scala.html
, which displays the HTML
layout, and another function that displays this welcome message. You can freely add any HTML fragment mixed with Scala
code in this file.
You can read more about Twirl, the template language used by Play, and how Play handles actions.
Need more info on the console?
For more information on the various commands you can run on Play, i.e. running tests and packaging applications for production, see Using the Play console.
Need to set up an IDE?
You can start hacking your application right now using any text editor. Any changes will be automatically reloaded at each page refresh, including modifications made to Scala source files.
If you want to set-up your application in IntelliJ IDEA or any other Java IDE, check the Setting up your preferred IDE page.
Need more documentation?
Play documentation is available at https://www.playframework.com/documentation.
Play comes with lots of example templates showcasing various bits of Play functionality at https://www.playframework.com/download#examples.
Need more help?
Play questions are asked and answered on Stackoverflow using the "playframework" tag: https://stackoverflow.com/questions/tagged/playframework
The Play Google Group is where Play users come to seek help, announce projects, and discuss issues and new features. If you don’t have a Google account, you can still join the mailing list by sending an e-mail to play-framework+subscribe@googlegroups.com.
Gitter is a real time chat channel, like IRC. The playframework/playframework channel is used by Play users to discuss the ins and outs of writing great Play applications.