Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
MVC – Nachwuchs im Hause Java EE
Search
Florian Hirsch
April 08, 2016
Programming
29
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MVC – Nachwuchs im Hause Java EE
Mathema Frühjahrscampus 2016 – 2016-04-08
Florian Hirsch
April 08, 2016
More Decks by Florian Hirsch
See All by Florian Hirsch
MVC – Back to the Server
lefloh
0
50
MVC – Back to the Server
lefloh
0
44
MVC – Back to the Server
lefloh
0
38
JavaScript Development Tools
lefloh
0
68
Real World Web Security
lefloh
0
63
MVC – Back to the Server
lefloh
0
44
Bullseye! – Let's play Dart
lefloh
0
63
Bullseye! – Ein Blick auf Dart
lefloh
0
46
Zur Hölle mit Responsive!
lefloh
0
36
Other Decks in Programming
See All in Programming
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
140
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
170
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
880
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
410
AWSに止められる覚悟してますか?
morizo_1984
2
530
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
270
Workers Cache を知る
syumai
0
360
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
Featured
See All Featured
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
530
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
We Are The Robots
honzajavorek
0
400
KATA
mclloyd
PRO
35
16k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Designing for Performance
lara
612
70k
How GitHub (no longer) Works
holman
316
150k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Transcript
MVC – Java EE Nachwuchs – Florian Hirsch 1 Copyright
© 2016 MATHEMA Software GmbH MVC – Nachwuchs im Hause Java EE Florian Hirsch / adorsys
[email protected]
twitter.com/lefloh / github.com/lefloh
MVC – Java EE Nachwuchs – Florian Hirsch 2 Copyright
© 2016 MATHEMA Software GmbH Let‘s build a Java EE Web Application!
MVC – Java EE Nachwuchs – Florian Hirsch 3 Copyright
© 2016 MATHEMA Software GmbH Servlets and JSPs?
MVC – Java EE Nachwuchs – Florian Hirsch 4 Copyright
© 2016 MATHEMA Software GmbH Portlets?
MVC – Java EE Nachwuchs – Florian Hirsch 5 Copyright
© 2016 MATHEMA Software GmbH JSF?
MVC – Java EE Nachwuchs – Florian Hirsch 6 Copyright
© 2016 MATHEMA Software GmbH JAX-RS?
MVC – Java EE Nachwuchs – Florian Hirsch 7 Copyright
© 2016 MATHEMA Software GmbH RESTful Websites?
MVC – Java EE Nachwuchs – Florian Hirsch 8 Copyright
© 2016 MATHEMA Software GmbH Java EE 8 Community Survey Results from the Java EE 8 Community Survey
MVC – Java EE Nachwuchs – Florian Hirsch 9 Copyright
© 2016 MATHEMA Software GmbH Goals n Leverage existing Java EE technologies n Integrate with CDI and Bean Validation n Define a solid core to build MVC applications without necessarily supporting all the features in its first version n Explore layering on top of JAX-RS for the purpose of re-using its matching and binding layers n Provide built-in support for JSPs and Facelets view languages MVC Specification (Early Draft Review 2)
MVC – Java EE Nachwuchs – Florian Hirsch 10 Copyright
© 2016 MATHEMA Software GmbH Non Goals n Define a new view (template) language and processor n Support standalone implementations of MVC running outside of Java EE n Support REST services not based on JAX-RS n Provide built-in support for view languages that are not part of Java EE MVC Specification (Early Draft Review 2)
MVC – Java EE Nachwuchs – Florian Hirsch 11 Copyright
© 2016 MATHEMA Software GmbH Status Commits to Ozark (Reference Implementation)
MVC – Java EE Nachwuchs – Florian Hirsch 12 Copyright
© 2016 MATHEMA Software GmbH JSF Controller @Named @RequestScoped public class CustomerController { @Inject private CustomerVO vo; @Inject private CustomerDAO dao; public String showCustomer(long id) { Customer customer = dao.findCustomer(id); vo.setCustomer(customer); return "customer.xhtml"; } }
MVC – Java EE Nachwuchs – Florian Hirsch 13 Copyright
© 2016 MATHEMA Software GmbH AngularJS Controller app.controller('customerCtrl', function($scope, $http) { $scope.showCustomer = function(id) { $http.get('/api/customers/' + id).then(function(response) { $scope.customer = response.data; }); }; });
MVC – Java EE Nachwuchs – Florian Hirsch 14 Copyright
© 2016 MATHEMA Software GmbH AngularJS Controller + JAX-RS Resource app.controller('customerCtrl', function($scope, $http) { $scope.showCustomer = function(id) { $http.get('/api/customers/' + id).then(function(response) { $scope.customer = response.data; }); }; }); @Path("customers") public class CustomerController { @Inject private CustomerDAO dao; @Path("{id}") public Customer showCustomer(@PathParam("id") Long id) { return dao.findCustomer(id); } }
MVC – Java EE Nachwuchs – Florian Hirsch 15 Copyright
© 2016 MATHEMA Software GmbH MVC Controller @Controller @Path("customers") public class CustomerController { @Inject private Models models; @Inject private CustomerDAO dao; @Path("{id}") public String showCustomer(@PathParam("id") Long id) { Customer customer = dao.findCustomer(id); models.put("customer", customer); return "customer.jsp"; } }
MVC – Java EE Nachwuchs – Florian Hirsch 16 Copyright
© 2016 MATHEMA Software GmbH MVC Controller @Controller @Path("customers") public class CustomerController { @Inject private Models models; @Inject private CustomerDAO dao; @Path("{id}") public Response showCustomer(@PathParam("id") Long id) { Customer customer = dao.findCustomer(id); models.put("customer", customer); return Response.ok("customer.jsp").build(); } }
MVC – Java EE Nachwuchs – Florian Hirsch 17 Copyright
© 2016 MATHEMA Software GmbH MVC Controller @Controller @Path("customers") public class CustomerController { @Inject private Models models; @Inject private CustomerDAO dao; @Path("{id}") public Viewable showCustomer(@PathParam("id") Long id) { Customer customer = dao.findCustomer(id); models.put("customer", customer); return new Viewable("customer.jsp"); } }
MVC – Java EE Nachwuchs – Florian Hirsch 18 Copyright
© 2016 MATHEMA Software GmbH MVC Controller @Controller @Path("customers") public class CustomerController { @Inject private Models models; @Inject private CustomerDAO dao; @Path("{id}") @View("customer.jsp") public void showCustomer(@PathParam("id") Long id) { Customer customer = dao.findCustomer(id); models.put("customer", customer); } }
MVC – Java EE Nachwuchs – Florian Hirsch 19 Copyright
© 2016 MATHEMA Software GmbH MVC Controller (CDI) @Controller @Path("customers") public class CustomerController { @Inject private Customer customer; @Path("{id}") public String showCustomer(@PathParam("id") Long id) { return "customer.jsp"; } }
MVC – Java EE Nachwuchs – Florian Hirsch 20 Copyright
© 2016 MATHEMA Software GmbH JSF View <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" template="/resources/mainTemplate.xhtml"> <ui:param name="pageTitle" value="Customers" /> <ui:define name="main"> <h:dataTable id="customers" var="customer" value="#{customerController.allCustomers}"> <h:column> <f:facet name="header">Name</f:facet> <h:commandLink action="#{customerController.showCustomer(customer.id)}"> <h:outputText value="#{customer.name}" /> </h:commandLink> </h:column> </h:dataTable> </ui:define> </ui:composition>
MVC – Java EE Nachwuchs – Florian Hirsch 21 Copyright
© 2016 MATHEMA Software GmbH AngularJS View <!doctype html> <html lang="en"> <head> <title>Customers</title> </head> <body ng-app="myApp"> <table ng-controller="customerCtrl"> <tr> <th>Name</th> </tr> <tr ng-repeat="customer in customers"> <td ng-click="showCustomer(customer.id)"> {{ customer.name }} </td> </tr> </table> </body> </html>
MVC – Java EE Nachwuchs – Florian Hirsch 22 Copyright
© 2016 MATHEMA Software GmbH MVC View (JSP) <%@ page contentType="text/html; charset=utf-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!doctype html> <html> <head> <title>Customers</title> </head> <body> <table> <tr> <th>Name</th> </tr> <c:forEach var="customer" items="${customers}"> <tr> <td><a href="${mvc.basePath}/customers/${customer.id}"> ${customer.name} </a></td> </tr> </c:forEach> </table> </body> </html>
MVC – Java EE Nachwuchs – Florian Hirsch 23 Copyright
© 2016 MATHEMA Software GmbH MVC View (Mustache) <!doctype html> <html> <head> <title>Customers</title> </head> <body> <body> <table> <tr> <th>Name</th> </tr> {{#customers}} <tr> <td><a href="{{mvc.basePath}}/customers/{{id}}">{{ name }}</a></td> </tr> {{/customers}} </table> </body> </html>
MVC – Java EE Nachwuchs – Florian Hirsch 24 Copyright
© 2016 MATHEMA Software GmbH Other ViewEngines n AsciiDoc n Freemarker n Handlebars n Jade n JSR 223 n Mustache n StringTemplate n Thymeleaf n Velocity
MVC – Java EE Nachwuchs – Florian Hirsch 25 Copyright
© 2016 MATHEMA Software GmbH linkTo Method <%@ page contentType="text/html; charset=utf-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!doctype html> <html> <head> <title>Customers</title> </head> <body> <table> <tr> <th>Name</th> </tr> <c:forEach var="customer" items="${customers}"> <tr> <td><a href="${mvc.linkTo('CustomerController', 'showCustomer', {'id': customer.id})}"> ${customer.name} </a></td> </tr> </c:forEach> </table> </body> </html>
MVC – Java EE Nachwuchs – Florian Hirsch 26 Copyright
© 2016 MATHEMA Software GmbH linkTo Controller <%@ page contentType="text/html; charset=utf-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!doctype html> <html> <head> <title>Customers</title> </head> <body> <table> <tr> <th>Name</th> </tr> <c:forEach var="customer" items="${customers}"> <tr> <td><a href="${mvc.linkTo('show-customer', {'id': customer.id})}"> ${customer.name} </a></td> </tr> </c:forEach> </table> </body> </html>
MVC – Java EE Nachwuchs – Florian Hirsch 27 Copyright
© 2016 MATHEMA Software GmbH Content-Type @Controller @Path("something") @Produces("text/html") public class SomeController { ... } <%@ page contentType="text/html; charset=utf-8" language="java" %>
MVC – Java EE Nachwuchs – Florian Hirsch 28 Copyright
© 2016 MATHEMA Software GmbH Validation @Controller @Path("customers") public class ValidationController { @Inject private BindingResult br; @Inject private Errors errors; @POST @ValidateOnExecution(type = ExecutableType.NONE) public Response newCustomer(@Valid @BeanParam CustomerForm form) { if (br.isFailed()) { for (ValidationError error : br.getAllValidationErrors()) { errors.add(new Error(error.getParamName(), error.getMessage())); } return Response.status(BAD_REQUEST) .entity("customer-form.jsp").build(); } return Response.status(OK).entity("customer-view.jsp").build(); } }
MVC – Java EE Nachwuchs – Florian Hirsch 29 Copyright
© 2016 MATHEMA Software GmbH PR 1: ValidationError /** * <p>Represents a single validation error detected for a parameter. * A validation error always corresponds to exactly one * {@link ConstraintViolation}.</p> * * @author Christian Kaltepoth * @since 1.0 */ public interface ValidationError { String getParamName(); ConstraintViolation<?> getViolation(); String getMessage(); } https://github.com/mvc-spec/mvc-spec/pull/1
MVC – Java EE Nachwuchs – Florian Hirsch 30 Copyright
© 2016 MATHEMA Software GmbH PR 2: LocaleResolver /** * <p>Locale resolvers are used to determine the locale of the current * request and are discovered using CDI.</p> * * <p>The MVC implementation is required to resolve the locale for each * request following this algorithm:</p> * * ... * * @author Christian Kaltepoth */ public interface LocaleResolver { String DEFAULT_LOCALE = "javax.mvc.locale.LocaleResolver.defaultLocale"; Locale resolveLocale(LocaleResolverContext context); } https://github.com/mvc-spec/mvc-spec/pull/2
MVC – Java EE Nachwuchs – Florian Hirsch 31 Copyright
© 2016 MATHEMA Software GmbH PR 3: Servlet Dependency Remove Servlet dependencies from MVC API? https://github.com/mvc-spec/mvc-spec/pull/3
MVC – Java EE Nachwuchs – Florian Hirsch 32 Copyright
© 2016 MATHEMA Software GmbH PR 4: OSGI Module Package MVC 1.0 as OSGI bundle? https://github.com/mvc-spec/mvc-spec/pull/4
MVC – Java EE Nachwuchs – Florian Hirsch 33 Copyright
© 2016 MATHEMA Software GmbH Fragen? Vielen Dank!
[email protected]