Java EE 8 MVC (JSR-371) Example

Java EE 8 comes with a lean Model View Controller (MVC) specification for action based web frameworks JSR-371. The PDF document is 33 pages lean and pragmatic.

Project is the reference implementation and it already works well on GlassFish 4.1 daily build.

To get a feeling for the spec I implemented a simplistic example based on the ECB idea:

package com.airhacks.time.presentation;

import javax.inject.Inject;
import javax.mvc.Controller;

public class TimeController {

    Models models;

    AtomClock clock;

    public String now() {
        this.models.put("time", new Time(clock.currentTime()));
        return "/time.jsp";


The whole project with WAR and sources was pushed to

I also introduced the MVC sample in the 14th airhacks Q&A broadcast

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


I think the most important thing distinguishing JAX-RS from MVC-JSR is possibility to use a session, right? Is it already possible?

Posted by PeterW on May 06, 2015 at 08:55 PM CEST #

Really ? Ten years ago with Spring I writed the same code, isn't a big innovation this mvc jsr in the 2015

Posted by Ciccio on May 07, 2015 at 04:53 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments