Senior software developer at Lunatech Research since 2004. Peter works on web application architecture, design and construction, with technical project management. He also does sales, marketing and recruitment work. His interests include Java web application frameworks, agile software development process and practices, and web-based collaboration. Peter has posted 1 posts at DZone. View Full User Profile

Play! Framework Usability

  • submit to reddit

Perhaps the most striking thing about about the Play! framework is that its biggest advantage over other Java web application development frameworks does not fit into a neat feature list, and is only apparent after you have used it to build something. That advantage is usability.

Note that usability is separate from functionality. In what follows, I am not suggesting that you cannot do this in some other framework: I merely claim that it is easier and more pleasant in Play! I need to emphasise this because geeks often have a total blind spot for usability because they enjoying figuring out difficult things, and under-appreciate the value of things that Just Work.

Written by web developers for web developers

The first hint that something different is going on here is when you first hear that the Play! framework is 'written by web developers for web developers', an unconventional positioning that puts the web's principles and conventions first and Java's second. Specifically, this means that the Play! framework is more in line with the W3C's Architecture of the World Wide Web than it is with Java Enterprise Edition (Java EE) conventions.

URLs for perfectionists

For example, the Play! framework, like other modern web frameworks, provides first-class support for arbitrary 'clean' URLs, which has always been lacking from the Servlet API. It is no coincidence that at the time of writing, Struts URLs for perfectionists, a set of work-arounds for the Servlet API-based Struts 1.x web framework, remains the third-most popular out of 160 articles on despite being a 2005 article about a previous-generation Java web technology.

In Servlet-based frameworks, the Servlet API does not provide useful URL-routing support; Servlet-based frameworks configure web.xml to forward all requests to a single controller Servlet, and then implement URL routing in the framework, with additional configuration. At this point, it does not matter whether the Servlet API was ever intended to solve the URL-routing problem and failed by not being powerful enough, or whether it was intended to be a lower-level API that you do not build web applications in directly. Either way, the result is the same: web frameworks add an additional layer on top of the Servlet API, itself a layer on top of HTTP.

Play! combines the web framework, HTTP API and the HTTP server, which allows it to implement the same thing more directly with fewer layers and a single URL routing configuration. This configuration, like Groovy's and Cake PHP's, reflects the structure of an HTTP request - HTTP method, URL path, and then the mapping:

# Play! 'routes' configuration file…

# Method URL path Controller

GET / Application.index
GET /about Application.about
POST /item Item.addItem
GET /item/{id} Item.getItem
GET /item/{id}.pdf Item.getItemPdf

In this example, there is more than one controller. We also see the use of an id URL parameter in the last two URLs.


Another example is Play!'s Http.Request class, which is a far simpler than the Servlet API's HttpServletRequest interface. In addition, Play! uses a class where Java EE 6 uses the Java EE convention of using an interface. This interface is also split between HttpServletRequest and the more generic ServletRequest interface. This separation may be useful if you want to use Servlets for things other than web applications, or if you want to allow for the unlikely possibility of the web changing protocol, but for most of us it is merely irrelevant complexity. In other words, the Servlet API is always used with a framework on top these days because it is sub-optimised for building web applications, which is what all of us actually use it for. Play! fixes that.

Better usability is not just for normal people

Another way of looking at the idea that Play! is by and for web developers is to consider how a web developer might approach software design differently to a Java EE developer. When you write software, what is the primary interface? If you are a web developer, the primary interface is a web-based user-interface constructed with HTML, CSS and (increasingly) JavaScript. A Java EE developer, on the other hand, may consider their primary interface to be a Java API, or perhaps a web services API, for use by other layers in the system.

This difference is a big deal, because a Java interface is intended for use by other programmers, while a web user-interface interface is intended for use by non-programmers. In both cases, good design includes usability, but usability for normal people is not the same as usability for programmers. In a way, usability for everyone is a higher standard than usability for programmers, when it comes to software, because programmers can cope better with poor usability. This is a bit like the Good Grips kitchen utensils: although they were originally designed to have better usability for elderly people with arthritis, it turns out that making tools easier to hold is better for all users.

The Play! framework is different because the usability that you want to achieve in your web application is present in the framework itself. For example, the web interface to things like the framework documentation and error messages shown in the browser is just more usable. Along similar lines, the server's console output avoids the pages full of irrelevant logging and pages of stack traces when there is an error, leaving more focused and more usable information for the web developer.

$ play run phase
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~ play! 1.0,
~ Ctrl+C to stop
Listening for transport dt_socket at address: 8000
10:15:58,629 INFO ~ Starting /Users/peter/Documents/work/workspace/phase
10:16:00,007 WARN ~ You're running Play! in DEV mode
10:16:00,424 INFO ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
10:16:11,847 INFO ~ Connected to jdbc:hsqldb:mem:playembed
10:16:13,448 INFO ~ Application 'phase' is now started !
10:16:14,825 INFO ~ starting DispatcherThread
10:16:48,168 ERROR ~

Internal Server Error (500) for request GET /application/startprocess?account=x

Java exception (In /app/controllers/ around line 41)
IllegalArgumentException occured : Person not found for account x

play.exceptions.JavaExecutionException: Person not found for account x
at play.mvc.ActionInvoker.invoke(
at Invocation.HTTP Request(Play!)
Caused by: java.lang.IllegalArgumentException: Person not found for account x
at controllers.Application.startProcess(
at play.utils.Java.invokeStatic(
at play.mvc.ActionInvoker.invoke(
... 1 more

Try to imagine a JSF web application producing a stack trace this short. In fact, Play! goes further: instead of showing the stack trace, the web application shows the last line of code within the application that appears in the stack trace. After all, what you really want to know is where things first went wrong in your own code.

This kind of usability does not happen by itself; the Play! framework goes to considerable effort to filter out duplicate and irrelevant information, and focus on what is essential.

Quality is in the details

In the Play! framework, much of the quality turns out to be in the details: they may be small things individually, rather than big important features, but they add up to result in a more comfortable and more productive development experience. The warm feeling you get when building something with Play! is the absence of the frustration that usually results from fighting the framework.

We recommend that you go to, download the latest binary release, and spend half an hour on the tutorial.

Peter Hilton is a senior software developer at Lunatech Research.

Published at DZone with permission of its author, Peter Hilton.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


David Lee replied on Tue, 2010/03/16 - 4:13pm

I saw Play! quite some time ago.  My IT department was reviewing frameworks, to get off of struts, I mentioned Play!, they endup choosing Spring MVC.  Which imo offers little more than what struts did.  I didn't expect them to choose Play!, but I did think they would have given it a look. Nope. Not even a glance.

 Now all day long I have to listen to/field question X, Y, Z about how to configure this and which one of 10,000 annotations do I have to use for this ?   It seems like nothing but configuration ever gets done.

For some reason, the frameworks that aim to improve productivity in a serious way(Grails, Play!, T5),  very often seemed to get overlooked for those that don't

Well, this is a very innovative framewok that warrants a close look by those that aren't pleased with their current web framework.


Otengi Miloskov replied on Tue, 2010/03/16 - 4:52pm

@David Lee tell to your team download Spring Roo and in few mins you will be up and running a complete spring application from domain's to controllers with all the configuration and annotations plus spring security, login page, themes, all, And you could export the project to eclipse format to add to your IDE for editing. Spring Roo is really a time saver.

Check this tutorial about Spring Roo so you can see it by your self:


By the way Apache Wicket is getting a lot of acceptance lately, At the place I work it is a big company and we are using Wicket with Spring and I have listen that other teams at  important companies are using Wicket too. Wicket it is an awesome, easy component based and modern framework, You could try it and see by your self. 

Zqudlyba Navis replied on Tue, 2010/03/16 - 6:09pm


I don't want a web framework that takes a long time to learn.  A framework that requires you to buy a big fat book or read stacks of reference materials is seriously flawed.

Spring MVC has a thousand configuration that you need to wrestle with.

Wicket and GWT syntax are very hard to read, as they are littered with anonymous inner classes - the very thing that made Swing a failure compared to VB.

SpringRoo could bootstrap you really quickly, but more codes are written in maintenance and upgrades than actual bootstrapping and development.

I just want a really productive and powerful and light weight java web framework (with REST and AJAX support) that is easy to learn, don't need lots of books or reference materials just to get started, and be able to produce codes that are easy to read, less verbose and pleasant to the eyes.


Otengi Miloskov replied on Wed, 2010/03/17 - 12:58pm in response to: Zqudlyba Navis

@zquadlyba So you dont want to read Java code, You don't want to continue to improve and study technology with big fat books, The configurations options that makes flexible SpringMVC are hard to grok, You want something super easy, something as visual basic that can program and generate all the code for you hmmm, you have 2 options my friend:

1.Quit programming/computer science and do something else.

2.Lie to your self thinking you are a programmer and use something that generates code for you hmm maybe as Rails or something easy framework in a scripting language.

If you want to be a Java dev, Use Java and all the options that offer even I suggest you study servlets, One day you will need maybe to use directly the servlet API because the framework could not handle what you wanted.

Nicolas Leroux replied on Thu, 2010/03/18 - 5:01am in response to: Otengi Miloskov

Play! isn't a code generator. It just make it easier to develop a web applications. Play! isn't using the Servlet and does not require a servlet container. Complexity isn't a necessity in Java. I would advise you have a look at other frameworks and languages: Django, RoR, Pylon, Cake, etc...

Otengi Miloskov replied on Thu, 2010/03/18 - 7:07pm in response to: Nicolas Leroux

Hehe been there did that, Anyway I use django for some projects and I love Python but when I need a matured and robust platform I use Java(Wicket, Spring MVC, etc). And of course Java is not necesarily to be complex as I said there is Wicket very simple pure Java/HTML framework and very easy to use but the last folk said even Wicket is complicate for him and that is a problem, So I concluded that maybe he does not want to be a programmer at all, he just need a tool that generates a program and that is not creativity or real programming.

About this article, Play looks good. I evaluated the framework before like 4 months ago but the only thing I didnt like was the template because is based on groovy and I commented that maybe was better to use something Java folks understand to use as JSP or Freemarker but the author of the framework told me that play with this kind of template have better integration and another things are better but maybe that is why is stoping me to using the framework. Maybe I will have to re-evualate it to understand more their template when I have time.


Ivan Lazarte replied on Fri, 2010/03/19 - 3:06pm

Spring doesn't have a "thousand" configurations to learn unless you need to integrate a "thousand" frameworks. One of my favorite spring apps sends emails, texts, aim, authenticates via openid or facebook, has cronjobs, database cache, generalized ehcache implementation, and maybe has 4 xml bean entries in it. The rest is autowired and gorgeous. I don't bother with spring mvc since I wrote my own layer in about 200 or so lines of awesomeness - I include spring directly in my own servlet. You really can't fault Spring - it's probably one of the best damn things about Java out there. I like plays routing premise though - will definitely investigate further as I can see it replacing some of jstl tag work. For example I wrap requests in "get" or "post" tags and use an expression language to invoke the right method on my beans...

Gareth Uren replied on Mon, 2010/03/22 - 2:33pm in response to: Ivan Lazarte

@Ivan Would it be possible for you to share you own mvc layer with the rest of us?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.