Documentation

You are viewing the documentation for the 2.6.21 release in the 2.6.x series of releases. The latest stable release series is 3.0.x.

§Hello World Tutorial

This tutorial describes how Play applications work, and shows you how to create a page that displays a customized Hello World greeting.

You can use any Java build tool to build a Play project. This tutorial demonstrates sbt and Gradle because they both provide the development experience Play is known and loved for, such as auto-reloading, clear error messages, and template compilation. The tutorial procedures assume use of sbt or gradlew commands from a terminal, but you can also integrate Play projects with your favorite IDE.

§Starting the project

Before following the tutorial instructions:

  1. Make sure you have verified the requirements for running Play
  2. Obtain the appropriate example zip file:
    1. Play Java Starter Example
    2. Play Scala Starter Example
  3. Unzip and run the example following the steps in the README.md file.

§Introduction to Play

As illustrated below, Play is a full-stack framework with all of the components you need to build a Web Application or a REST service, including: an integrated HTTP server, form handling, Cross-Site Request Forgery (CSRF) protection, a powerful routing mechanism, I18n support, and more. Play integrates with many object relational mapping (ORM) layers. It supports Anorm, Ebean, Slick, and JPA out-of-the-box, but many customers use NoSQL, other ORMs or even access data from a REST service.

Play APIs are available in both Java and Scala. The Framework uses Akka and Akka HTTP under the hood. This endows Play applications with a stateless, non-blocking, event-driven architecture that provides horizontal and vertical scalability and uses resources more efficiently. Play projects contain Scala components, but because Play has a Java API, you do not need to learn Scala to use Play successfully if you are a Java developer.

Here are just a few of the reasons developers love using Play Framework:

To learn more about Play’s benefits, see Play’s Introduction and Philosophy. Now, let’s dive into what a Play application looks like.

Next: Play Application Overview