Java Reference
In-Depth Information
Deleting Books
Now that you can create books, you need to be able to delete them. For this you need to implement
the deleteBook() action, as illustrated in Listing 8-16.
Listing 8-16. Implementing the Delete Action
1. public static Result deleteBook(Long id) {
2. Book.delete(id);
3. return redirect(routes.Application.books());
4. }
This concludes the chapter and this topic. One chapter is not enough to cover all the features of
the Play 2 framework (or any framework, for that matter). Meanwhile, frameworks and the web
architecture are evolving at a rapid pace toward real-time processing, integrating more concurrent
real-time data, so web frameworks need to support a full asynchronous HTTP programming model
and need to use the event model through Web Sockets. Play 2 provides an asynchronous HTTP
API instead of the standard Servlet API, thus moving away from standard JEE conventions. Play 2.0
employs the Actor-based model to handle highly concurrent systems through Akka. Akka is the best
implementation of Actor-based models available for both Java and Scala. Play 2.0 provides native
Akka support making it possible to write highly-distributed systems.
The goals of this topic were to show you that the wave the Java language ushered into Web
development in late '90s was only a beginning of the Typesafe era that is being transcended today
and that the popularity that Java has enjoyed should be accredited to the Java Virtual Machine. It is
quite a machine.
Summary
In this chapter, you took a high-level look at the Play 2 framework. You developed a helloworld web
application for both Java and Scala, and you learned the basics that are common to all the Play
2 web applications: Java and Scala controllers, actions, and even a bit of views. In addition, you
examined the differences between Java and Scala controllers. You saw the best features provided
by Play 2, such as compilation on the fly and errors shown on the browser. Then you developed a
simple Java-based CRUD web application.
 
Search WWH ::




Custom Search