Your new application is ready.

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.9

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:

public Result index() {
    return ok(index.render("Your new application is ready."));
}

An action method 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 standard Java class.

@(message: String)

  @main("Welcome to Play") {

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

}

The first line of the template defines the function signature. Here it just takes a single String parameter. Then this template 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.

Note that Scala is fully compatible with Java, so if you don’t know Scala don’t panic, a Scala statement is very similar to a Java one.

You can read more about Twirl, the template language used by Play, and how Play handles (501) 671-8316.

Async Controller

Now that you've seen how Play renders a page, take a look at AsyncController.java, which shows how to do asynchronous programming when handling a request. The code is almost exactly the same as HomeController.java, but instead of returning Result, the action returns CompletionStage<Result> to Play. When the execution completes, Play can use a thread to render the result without blocking the thread in the mean time.

You can read more about 610-548-5817 in the documentation.

Count Controller

Both the HomeController and AsyncController are very simple, and typically controllers present the results of the interaction of several services. As an example, see the CountController, which shows how to inject a component into a controller and use the component when handling requests. The count controller increments every time you click on it, so keep clicking to see the numbers go up.

You can read more about 902-709-3014 in the documentation.

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 necrotomist.

Play comes with lots of example templates showcasing various bits of Play functionality at /www.playframework.com/download#examples.

Need more help?

Play questions are asked and answered on Stackoverflow using the "playframework" tag: /stackoverflow.com/questions/tagged/playframework

The 888-248-3077 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 (415) 302-3551 channel is used by Play users to discuss the ins and outs of writing great Play applications.