Java EE is evolving and there are a lot of news coming in Java EE 8. Java EE is constantly adopting standards and now is time to the new spec MVC 1.0
(JSR-371) is part of Java EE 8 which will be released in 2016.
If you are thinking on a new concept, let me tell that you are wrong MVC is Model, View, Controller the pattern for web frameworks and you already knew it.
Now, UI frameworks has been categorized in:
- Action-based, like MVC.
- Component-based, like JSF.
But, I am pretty sure that you have the following question Why another MVC framework?.
Complete integration with Jersey (JAX-RS) and obviously with all Java EE ecosystem.
You can see in ozark github repository the RI (Reference Implementation) to the frameworks below:
- Freemaker
- Handlebars
- Mustache
- Thymeleaf
- Velocity
Note: Glassfish 4.1, is the only Server Application which support this specification at the time I am writing this post.
To use it in your projects add the this dependency in your pom.xml (if you are using maven)
1 2 3 4 5 |
|
JSP’s are located at src/main/webapp/WEB-INF/views
folder.
There are 4 ways to return a view:
- Void method with
@View
and the jsp name. - Return
String
with the jsp name. - Return
Viewable
class with the jsp name. - Return
Response
class from JAX-RS to return the jsp name as a entity.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
If you can check the code of this API take a look the github repository MVC 1.0