MVC framework, recently launched for Java EE 8, is based on JAX-RS and is able to cooperate with Java EE technologies. Ozark is a reference implementation for this action-based framework.
This is the most basic information about the new platform of Java EE MVC. In this article we will provide essential information concerning cooperation of the basic Java EE MVC applications with Ozark.
First and foremost, it is necessary to take into consideration that MVC specification is still developing and the final version of it will appear no sooner than in 2016. At the moment it is advisable to work with the recent version of GlassFish and current Ozark release.
Experts in JAX-RS will be glad to find many familiar things as Java EE MVC is based on it. So if we want to create a MVC app, it is necessary to create JAX-RS Application class first.
How to Create the Controller of the App?
Incoming requests are processed with help of the controller that executes business logic and updates the logic. Also it specifies the view that calls for rendering. The class here is annotated with @Controller and @Path and the instance of Models is already injected there.
In the sayHello() method the parameters are bound to request parameters and the name of it is used to create a text message. That message afterwards will be added to the Model. Views that require rendering are defined by the returned String.
How to Build the View?
Using GlassFish developer gets an opportunity to run new MVC apps and send a GET requests to controller in order to check whether it will return or not. This framework is quite easy and uses existing Java technologies so it will be simple to dedicated developers.