concept Play in category scala

appears as: Play
Play for Scala: Covers Play 2

This is an excerpt from Manning's book Play for Scala: Covers Play 2.

Figure 1.2. Java EE “lasagna” architecture compared to Play’s simplified architecture

Play supports Java, and it’s the best way to build a Java web application. Java’s success as a programming language, particularly in enterprise software development, has enabled Play to quickly build a large user community. Even if you’re not planning to use Play with Java, you still get to benefit from the size of the wider Play community. Besides, a large segment of this community is now looking for an alternative to Java.

Struts 1.x has an action-based MVC architecture that isn’t all that different from Play’s. This means that to display a product details page, which shows information about a specific product, we’d write a ProductDetailsAction Java class, and access it with a URL such as this:

When people first started using the web, the experience was so liberating that they called it surfing. This is why HATEOAS is so important to web applications, and why the Play framework’s affinity with web architecture makes it inevitable that Play includes powerful and flexible reverse routing functionality to make it easy to generate internal URLs.

Listing 7.14. Definition of Play’s Formatter trait
trait Formatter[T] {
  def bind(key: String, data: Map[String, String]):
    Either[Seq[FormError], T]

  def unbind(key: String, value: T): Map[String, String]

  val format: Option[(String, Seq[Any])] = None
}