Developing the UI with Play Framework

In the previous chapter, we performed bootstrapping on our application using Activator. In this chapter, we will continue developing our web application using Scala and Play framework. Play framework is great for web development because it is simple to use, and at the same time, very powerful. This is because it uses top-notch reactive solutions like spray, Akka, and Akka Stream under the hood. For this chapter, we will create the basic UI for some parts of our reactive web solution by adding validation and an in-memory store so you can feel the application working. We will use a little bit of CSS for styling, and JavaScript for some simple visualizations.

In this chapter, we will cover the following topics:

  • • Basics of web development with Scala and Play frameworks
  • • Creating your models
  • • Working with views and validations
  • • Working with session scopes

Getting started

Let's have a look at the preview of Reactive Web Store—the application that we will build.

For now, we will build three simple operations-Create, Retrieve, Update, and Delete (CRUD) in order to manage products, product reviews, and product images. We will create models, controllers, views, and routes for each CRUD.

Let's get started. First of all, we need to define our models. The models need to be located at ReactiveWebStore/app/models. Models are the CORE of the system and they represent the entity. We will use this entity later to store and retrieve data from a database later on in chapter 6, Persistence with Slick. Our models should not have any UI logic, since we should use controllers for UI logic.

< Prev   CONTENTS   Source   Next >