SlideShare a Scribd company logo
1 of 72
Download to read offline
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Getting Start
Java EE Action-Based MVC
With Thymeleaf
Masatoshi Tada (Casareal ,Inc)
JJUG CCC 2016 Spring
2016-5-21(Sat)
1
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
About This Session
! Answer Your Question "Java EE is Useful
Framework As Next Struts?"
! View is Thymeleaf !
! Code on GitHub
! https://github.com/MasatoshiTada/jjug-action-based-
mvc
! Sorry, comments are written in Japanese
2
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
About Me
! Masatoshi Tada
!Casareal, Inc
!GlassFish User Group Japan
!Trainer(Java EE/Spring/Swift)
!Twitter:@suke_masa
3
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Agenda
① What’s "Action-Based MVC"?
② Getting Start MVC 1.0(EE 8)
③ Using Jersey MVC & RESTEasy HTML in
EE 7
④ Other Java EE Technologies You Should
Know
⑤ Final Conclusions
4
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
①What’s
"Action-Based MVC"?
5
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
What’s Action-Based MVC?
! Web Framework which focuses HTTP
request & response
! Most of framework are Action-Based
! Struts, Spring MVC, …
6
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
What’s Action-Based MVC?
7
View
View
Controller Model
request
response
Struts developer friendly
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
What’s "Component-Based MVC"?
8
View
Backing
Bean
Model
GUI(VB, Android…) developer friendly
-> Struts developer Un-Friendly
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Web Framework of Java EE
! JSF
! Responses HTML
! Component-Based
! JAX-RS
! Responses JSON/XML
! Action-Based
9
There’s no Framework
which is "Action-Based"
and "Responses HTML"
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Java EE Standard Action-Based MVC!!
! Model-View-Controller API (MVC 1.0)
! Java EE 8 (2017 H1)
! Based on JAX-RS
10
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
②Getting Start
MVC 1.0
11
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
MVC 1.0
! MVC 1.0 is Specification
! ≒Set of Interfaces, Annotations, and Exceptions
! Reference Implementation is Ozark
! Set of Implementation Classes of above
interfaces
12
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Main Functions of Struts
! Controller
! Validation
! Handling Exception
! View Technology
! Transaction Token
13
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
in MVC 1.0?
! Controller → ⭕
! Validation → ⭕
! Handling Exception → ⭕
! View Technology → ❌
! Transaction Token → ❌
14
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Why No View Technologies in MVC?
! Non-Goal 1 of MVC specification

"Define a new view (template)
language and processor."
! Instead, MVC provides integration with
many view technologies!
15
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
View Technologies
We Can Use in MVC 1.0
! MVC
! JSP, Facelets
! Ozark
! Thymeleaf, Mustache, Freemarker,

Handlerbars, Velocity, AsciiDoc, …
16
If you want to use other View,
Implement ViewEngine interface
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Problems of JSP and Facelets
17
! JSP
! Mix of Logic and View
! Sometime Occurs XSS
! Facelets
! Cannot Use All Features in MVC 1.0
! Bad Compatibility with JavaScript
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Let’s Use Thymeleaf!
18
! Pure HTML!
! Isolate View and Logic absolutely!
! Good Compatibility with JavaScript!
! Link Expression is very useful!
! Internationalizing message!
! http://www.thymeleaf.org/doc/tutorials/2.1/
usingthymeleaf.html#a-multi-language-welcome
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Using Thymeleaf in MVC 1.0
19
<dependency>
<groupId>org.glassfish.ozark.ext</groupId>
<artifactId>ozark-thymeleaf</artifactId>
<version>1.0.0-m02</version>
<scope>compile</scope>
</dependency>
! Just adding dependency like below
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Why No Transaction Token Feature?
! In Expert Group’s Mailing-List, 

"This is a client side concern"
! https://java.net/projects/mvc-spec/lists/
jsr371-experts/archive/2015-07/message/2
! Spring MVC has no transaction token
feature, too.
20
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
How to Avoid Double-Submit-Problem
! See TERASOLUNA Guideline
! http://terasolunaorg.github.io/guideline/
5.1.0.RELEASE/en/ArchitectureInDetail/
DoubleSubmitProtection.html
21
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Preparation : Enabling JAX-RS
22
@ApplicationPath("/api")
public class MyApplication extends Application {
}
Inherit Application class
Add Annotation
jjug-mvc10/src/main/java/com/example/rest/MyApllication.java
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Basic Controller
23
@Path("/employee")
public class EmployeeController {
@GET @Path("/index")
@Controller
public String index() {
return "employee/index.html";
}
} Path of View
(extention is REQUIRED)
Indicate as controller
method
Mapping to URL &
HTTP method
※Italic is feature of MVC
jjug-mvc10/src/main/java/com/example/rest/controller/EmployeeController.java
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Form Class
24
public class EmployeeIdForm {
@QueryParam("id")
@NotBlank
@Pattern(regexp = "[1-9][0-9]*")
private String id;
// setter/getter
}
Mapping to
"id" Query Parameter
Constraint of
Bean Validation
jjug-mvc10/src/main/java/com/example/rest/form/EmployeeIdForm.java
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Send Object to View
25
public class EmployeeController {
@Inject private Models models;
@GET @Path("/result") @Controller
@ValidateOnExecution(type=ExecutableType.NONE)
public String result(…) {
models.put("employee", employee);
return "employee/result.html";
}
Box of Object
(Map + Iterator)
Object referred
by View
jjug-mvc10/src/main/java/com/example/rest/controller/EmployeeController.java
※Italic is feature of MVC
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Referring Object in View
26
<table th:unless="${employee == null}">
<tr th:object="${employee}">
<td th:text="*{empId}">99999</td>
<td th:text="*{name}">Taro Yamada</td>
<td th:text="*{joinedDate}">2020-01-01</td>
<td th:text="*{department.deptId}">99</td>
<td th:text="*{department.name}">Admin</td>
</tr>
</table> WEB-INF/views is view folder
jjug-mvc10/src/main/webapp/WEB-INF/views/employee/result.html
Name put to Models
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Validation
27
public class EmployeeController {
@Inject private BindingResult br;
@GET @Path("/result") @Controller
@ValidateOnExecution(type=ExecutableType.NONE)
public String result( @Valid @BeanParam
EmployeeIdForm form) {
if (br.isFailed()) {
models.put("bindingResult", br);
return "employee/index.html"; // To input view
Box of Messages
Enable
Validation
Error Processing
jjug-mvc10/src/main/java/com/example/rest/controller/EmployeeController.java
※Italic is feature of MVC
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Showing Error Messages
28
<ul th:if="${bindingResult != null}">
<li th:each="message
: ${bindingResult.allMessages}"
th:text="${message}">
This is Dummy Message
</li>
</ul>
Get Messages From
BindingResult
jjug-mvc10/src/main/webapp/WEB-INF/views/employee/index.html
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Writing Error Messages
! Write messages in 

src/main/resources/
ValidationMessages.properties
! Specify Key of Message to "message"
attribute in Annotation
29
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Specifying Error Message Key
30
public class EmployeeIdForm {
@QueryParam("id")
@NotBlank(message = "{id.notblank}")
@Pattern(regexp = "[1-9][0-9]*",
message = "{id.pattern}")
private String id;
// setter/getter
Key of Message with "{}"
jjug-mvc10/src/main/java/com/example/rest/form/EmployeeIdForm.java
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Caution :
MVC has No "Form-Binding" Feature
! @BeanParam is not "Form-Binding"
! On error, If You want to leave values in
input-components on view, Write view as
Next
31
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Implementing Form-Binding
32
<form action="./result" method="get">
<input type="text" name="id" value=""
th:value="${param.id == null} ? ''
: ${param.id[0]}"/>
<input type="submit" value="search"/>
</form>
jjug-mvc10/src/main/webapp/WEB-INF/views/employee/index.html
Maybe Complex with
selectbox …
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Handling Exception
! Implement ExceptionMapper interface
! When error occurs, ExceptionMapper
catches Exception
! You can implement multiple
ExceptionMappers
33
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
ExceptionMapper class
34
@Provider
public class ExceptionMapper implements
javax.ws.rs.ext.ExceptionMapper<Exception> {
public Response toResponse(
Exception exception) {
// Forward to Error View…
}
}
Don’t Forget @Provider
Catches Exception as
Method Argument
Implement
ExceptionMapper
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Other Features of MVC
! Security (XSS, CSRF)
! File Upload, Download
! MvcContext (Easy Specifying URL)
! Hybrid Class (HTML and REST)
! More Details, See GUGJ Slides below
! http://www.slideshare.net/masatoshitada7/java-ee-8mvc-10
35
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Conclusions of this chapter
! MVC 1.0 + Thymeleaf covers almost
features of Struts!
! Need to implement Transaction Token
and Form-Binding By Yourself
! Features of MVC are Simple, Reveraging
existing Java EE Features.
36
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
③Using Jersey MVC &
RESTEasy HTML in EE 7
37
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
What framework should we use
in Java EE 7?
! MVC 1.0 is Java EE 8
! Java EE 8 will be released in 2017 H1
38
Let’s use
Jersey MVC or RESTEasy HTML in EE7!
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
What’s Jersey MVC?
! Original Extension of Jersey(JAX-RS RI)
! Similar to MVC 1.0
! GlassFish/Payara inside
! WebLogic not inside
39
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
What’s RESTEasy HTML?
! Original Extension of RESTEasy (other
implementation of JAX-RS)
! RESTEasy is inside WildFly/JBoss,

but RESTEasy HTML is not inside
40
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Basic Jersey MVC
! Register MvcFeature class to Your Application
sub class (ResourceConfig is Convinient)
41
@ApplicationPath("/api")
public class MyApplication extends ResourceConfig {
public MyApplication() {
register(MvcFeature.class);
property(MvcFeature.TEMPLATE_BASE_PATH,
"/WEB-INF/views/");
packages(true, "com.example.rest");
}
} jjug-jersey-mvc/src/main/java/com/example/rest/MyApplication.java
※Italic is Jersey MVC’s feature
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Basic Jersey MVC
! Return Viewable in controller methods
42
@Path("/employee")
public class EmployeeController {
@GET @Path("/index")
public ThymeleafViewable index(…) {
return new ThymeleafViewable(
"employee/index.html");
}
}
My original class
(Viewable’s subclass)
jjug-jersey-mvc/src/main/java/com/example/rest/controller/EmployeeControler.java
※Italic is Jersey MVC’s feature
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Basic Jersey MVC
! Add value to Viewable constructor’s 2nd
parameter
43
@Path("/employee")
public class EmployeeController {
@GET @Path("/result")
public ThymeleafViewable result(…) {
Map<String, Object> models = …
return new ThymeleafViewable(
"employee/result.html", models);
}
Put objects to Map
jjug-jersey-mvc/src/main/java/com/example/rest/controller/EmployeeControler.java
※Italic is Jersey MVC’s feature
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
How to Use Thymeleaf
with Jersey MVC
! Implment TemplateProcessor interface
(Provided by Jersey)
! AbstractTemplateProcessor class is
useful
! implementation of TemplateProcessor
44
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
ThymeleafTemplateProcessor
45
@Provider
public class ThymeleafTemplateProcessor
extends AbstractTemplateProcessor<String> {
private TemplateEngine templateEngine;
@Inject public ThymeleafTemplateProcessor(
Configuration config, ServletContext servletContext) {
super(config, servletContext, "html", "html");
TemplateResolver templateResolver =
new ServletContextTemplateResolver();
templateResolver.setPrefix((String) config.getProperty(
MvcFeature.TEMPLATE_BASE_PATH));
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
}
// to next slide
jjug-jersey-mvc/src/main/java/com/example/rest
/thymeleaf/ThymeleafTemplateProcessor.java
※Italic is Jersey MVC’s feature
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
ThymeleafTemplateProcessor
46
// 続き
@Override public void writeTo(...) {
WebContext webContext = new WebContext(
request, response, servletContext, request.getLocale());
Map<String, Object> map = (Map) viewable.getModel();
webContext.setVariables(map);
templateEngine.process(viewable.getTemplateName(),
webContext, response.getWriter());
}
}
jjug-jersey-mvc/src/main/java/com/example/rest
/thymeleaf/ThymeleafTemplateProcessor.java
Thymeleaf write
the response
※Italic is Jersey MVC’s feature
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Validation in Jersey MVC
! Jersey provides @ErrorTemplate annotation
to specify error view, but…
! This annotation is feature for handling
exception (not for validation)
! MVC 1.0 doesn’t have similar feature, so
migration will be difficult
! Cannot use "Validation Group" and "Group
Sequence" (Features of Bean Validation)
47
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Validate in Controller Methods
48
@Inject Validator validator;
@GET @Path("/result")
public ThymeleafViewable result(
@BeanParam EmployeeIdForm form) {
Set<ConstraintViolation<EmployeeIdForm>>
violations = validator.validate(form);
if (!violations.isEmpty()) {
Map<String, Object> model = …;
model.put("violations", violations);
return new ThymeleafViewable(
"employee/index.html", model);
}
Execute Bean Validation
No @Valid to arguments
Validate
On error,
return to
input view
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Showing Error Message
49
<ul th:if="${violations != null}">
<li th:each="violation : ${violations}"
th:text="${violation.message}">
This is Dummy Message
</li>
</ul>
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
About This Method
! Advantage
! Pure JAX-RS code
! Easy MVC 1.0 migration
! Avoid excess framework customization
! Disadvantage
! It takes time and effort
50
I Tried a variety of methods,
this method is best
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Handling Exception
! ExceptionMapper
! Same to MVC 1.0 sample code
51
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Redirect
! JAX-RSのコードで書けばOK
52
@GET @Path("/redirect")
public Response redirect(
@Context UriInfo uriInfo) throws Exception {
URI location = uriInfo.getBaseUriBuilder()
.path(HelloResource.class)
.path("redirect2")
.build();
return Response.status(Response.Status.FOUND)
.location(location).build();
}
UriInfo has variety of
method to build URI
Specify URI to Location header
Status code 3xx
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Basic RESTEasy HTML
! Create Application’s sub class
! No need to register any specific class
! By JAX-RS "Providers"
53
@ApplicationPath("/api")
public class MyApplication extends Application {
}
jjug-resteasy-html/src/main/java/com/example/rest/MyApplication.java
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Basic RESTEasy HTML
! Return Renderable in controller method
54
<<interface>>
Renderable
View class
(Forward)
Redirect class
(Redirect)
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Using Thymeleaf in RESTEasy HTML
! Create Renderable implementation class
55
<<interface>>
Renderable
View Redirect ThymeleafView
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
ThymeleafView
56
public class ThymeleafView implements Renderable {
private String templateName;
private Map<String, Object> models;
private TemplateEngine templateEngine;
public ThymeleafView(String templateName) {
this(templateName, new HashMap<>());
}
public ThymeleafView(String templateName,
Map<String, Object> models) {
this.templateName = templateName;
this.models = models;
}
void setTemplateEngine(TemplateEngine templateEngine) {
this.templateEngine = templateEngine;
}
Implement
Renderable
※Italic is RESTEasy HTML feature
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
ThymeleafView
57
// from previous slide
@Override
public void render(HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException, WebApplicationException {
response.setCharacterEncoding("UTF-8");
WebContext webContext = new WebContext(
request, response, request.getServletContext(),
request.getLocale());
webContext.setVariables(models);
templateEngine.process(templateName, webContext,
response.getWriter());
}
}
Call TemplateEngine#process() in render()
※Italic is RESTEasy HTML feature
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Creating Interceptor
Setting TemplateEngine to ThymeleafView
! Use JAX-RS WriterInterceptor
! Create custom annotation with
NameBinding, to specify which
controller apply interceptor
! There’re many ways(This is not only
way)
58
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Creating annotation
59
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,
ElementType.TYPE})
@Documented
public @interface ThymeleafController {
}
Create annotation
with @NameBinding
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Creating WriterInterceptor
60
@Provider
@ThymeleafController
public class ThymeleafWriterInterceptor
implements WriterInterceptor {
private TemplateEngine templateEngine;
@PostConstruct
public void init() {
TemplateResolver resolver =
new ServletContextTemplateResolver();
resolver.setPrefix("/WEB-INF/views/");
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(resolver);
}
Specify annotation you created
Implement WriterInterceptor
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Creating WriterInterceptor
61
@Override
public void aroundWriteTo(WriterInterceptorContext context)
throws IOException, WebApplicationException {
Object entity = context.getEntity();
if (ThymeleafView.class.isAssignableFrom(entity.getClass())) {
ThymeleafView thymeleafView =
(ThymeleafView) context.getEntity();
thymeleafView.setTemplateEngine(templateEngine);
}
context.proceed();
}
}
Set TemplateEngine
before context.proceed()
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Controller
62
@GET @Path("result")
@ThymeleafController
public ThymeleafView result(…) {
Map<String, Object> models = …;
models.put("employee", employee);
return new ThymeleafView(
"employee/result.html", models);
}
Specify annotation
→Applying interceptor
View path and values
※Italic is RESTEasy HTML feature
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Validation and Handling Exception
! Same as Jersey MVC sample code
63
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Conclusions of this chapter
! In Java EE 7, 

Use Jersey MVC or RESTEasy HTML!
! Controller methods, views and handling
exceptions are same as MVC 1.0!
! They have no BindingResult, so validate
in controller methods!
64
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
④Other Java EE
Technologies
You Should Know
65
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
JAX-RS
! Specific features of MVC 1.0/Jersey MVC/
RESTEasy HTML are not many
! To achieve what you want to do, and
trouble-shooting, knowledge of JAX-RS is
very important
66
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
JAX-RS Reference
! JSR-339 JAX-RS 2.0 rev.A
! You should learn Processing Pipeline

(Appendix C)
! https://jcp.org/en/jsr/detail?id=339
! Jersey Document
! RESTEasy Document
67
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Others
! Bean Validation
! CDI
! JPA
68
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
⑤Final Conclusions
69
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Final Conclusions
! MVC 1.0 + Thymeleaf covers almost
features of Struts!
! In EE 7, Use Jersey MVC or RESTEasy
HTML!
! Understanding JAX-RS is very important!
70
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Caution
! Jersey MVC and RESTEasy HTML are 

NOT "Java EE 7 standard"
! They will be out of range 

of server vendors’ support
! In "Java EE 7 standard", 

JSF is the ONLY HTML Framework
71
#ccc_cd4
(C) CASAREAL, Inc. All rights reserved.
Enjoy Java EE!!
! Thank you!
72

More Related Content

What's hot

Web application development with laravel php framework version 4
Web application development with laravel php framework version 4Web application development with laravel php framework version 4
Web application development with laravel php framework version 4Untung D Saptoto
 
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...Edureka!
 
ADRという考えを取り入れてみて
ADRという考えを取り入れてみてADRという考えを取り入れてみて
ADRという考えを取り入れてみてinfinite_loop
 
北護大/FHIR 開發簡介與應用
北護大/FHIR 開發簡介與應用北護大/FHIR 開發簡介與應用
北護大/FHIR 開發簡介與應用Lorex L. Yang
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_contentNAVEENSAGGAM1
 
SSR with Quasar Framework - JSNation 2019
SSR with Quasar Framework - JSNation 2019SSR with Quasar Framework - JSNation 2019
SSR with Quasar Framework - JSNation 2019Razvan Stoenescu
 
input type = password autocomplete = off は使ってはいけない
input type = password autocomplete = off は使ってはいけないinput type = password autocomplete = off は使ってはいけない
input type = password autocomplete = off は使ってはいけない彰 村地
 
Next.js Introduction
Next.js IntroductionNext.js Introduction
Next.js IntroductionSaray Chak
 
Docker introduction
Docker introductionDocker introduction
Docker introductiondotCloud
 
iOSにおけるパフォーマンス計測
iOSにおけるパフォーマンス計測iOSにおけるパフォーマンス計測
iOSにおけるパフォーマンス計測Toshiyuki Hirata
 
Kubernetes
KubernetesKubernetes
Kuberneteserialc_w
 
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望Yoichi Kawasaki
 
AWS CDK introduction
AWS CDK introductionAWS CDK introduction
AWS CDK introductionleo lapworth
 
Tailwind CSS - KanpurJS
Tailwind CSS - KanpurJSTailwind CSS - KanpurJS
Tailwind CSS - KanpurJSNaveen Kharwar
 
Intégration et livraison continues des bonnes pratiques de conception d'appli...
Intégration et livraison continues des bonnes pratiques de conception d'appli...Intégration et livraison continues des bonnes pratiques de conception d'appli...
Intégration et livraison continues des bonnes pratiques de conception d'appli...Amazon Web Services
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLo Ki
 
AWS Black Belt Online Seminar 2017 Docker on AWS
AWS Black Belt Online Seminar 2017 Docker on AWSAWS Black Belt Online Seminar 2017 Docker on AWS
AWS Black Belt Online Seminar 2017 Docker on AWSAmazon Web Services Japan
 

What's hot (20)

Web application development with laravel php framework version 4
Web application development with laravel php framework version 4Web application development with laravel php framework version 4
Web application development with laravel php framework version 4
 
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
 
ADRという考えを取り入れてみて
ADRという考えを取り入れてみてADRという考えを取り入れてみて
ADRという考えを取り入れてみて
 
北護大/FHIR 開發簡介與應用
北護大/FHIR 開發簡介與應用北護大/FHIR 開發簡介與應用
北護大/FHIR 開發簡介與應用
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_content
 
SSR with Quasar Framework - JSNation 2019
SSR with Quasar Framework - JSNation 2019SSR with Quasar Framework - JSNation 2019
SSR with Quasar Framework - JSNation 2019
 
Oracle GoldenGate Veridata概要
Oracle GoldenGate Veridata概要Oracle GoldenGate Veridata概要
Oracle GoldenGate Veridata概要
 
input type = password autocomplete = off は使ってはいけない
input type = password autocomplete = off は使ってはいけないinput type = password autocomplete = off は使ってはいけない
input type = password autocomplete = off は使ってはいけない
 
Next.js Introduction
Next.js IntroductionNext.js Introduction
Next.js Introduction
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
iOSにおけるパフォーマンス計測
iOSにおけるパフォーマンス計測iOSにおけるパフォーマンス計測
iOSにおけるパフォーマンス計測
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
 
Spring boot
Spring bootSpring boot
Spring boot
 
AWS CDK introduction
AWS CDK introductionAWS CDK introduction
AWS CDK introduction
 
Tailwind CSS - KanpurJS
Tailwind CSS - KanpurJSTailwind CSS - KanpurJS
Tailwind CSS - KanpurJS
 
Azure dev ops
Azure dev opsAzure dev ops
Azure dev ops
 
Intégration et livraison continues des bonnes pratiques de conception d'appli...
Intégration et livraison continues des bonnes pratiques de conception d'appli...Intégration et livraison continues des bonnes pratiques de conception d'appli...
Intégration et livraison continues des bonnes pratiques de conception d'appli...
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
 
AWS Black Belt Online Seminar 2017 Docker on AWS
AWS Black Belt Online Seminar 2017 Docker on AWSAWS Black Belt Online Seminar 2017 Docker on AWS
AWS Black Belt Online Seminar 2017 Docker on AWS
 

Viewers also liked

Spring Bootの本当の理解ポイント #jjug
Spring Bootの本当の理解ポイント #jjugSpring Bootの本当の理解ポイント #jjug
Spring Bootの本当の理解ポイント #jjugMasatoshi Tada
 
Java EEハンズオン資料 JJUG CCC 2015 Fall
Java EEハンズオン資料 JJUG CCC 2015 FallJava EEハンズオン資料 JJUG CCC 2015 Fall
Java EEハンズオン資料 JJUG CCC 2015 FallMasatoshi Tada
 
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017Kohei Saito
 
Java SE 9の紹介: モジュール・システムを中心に
Java SE 9の紹介: モジュール・システムを中心にJava SE 9の紹介: モジュール・システムを中心に
Java SE 9の紹介: モジュール・システムを中心にTaku Miyakawa
 
JPAの同時実行制御とロック20140518 #ccc_r15 #jjug_ccc
JPAの同時実行制御とロック20140518 #ccc_r15 #jjug_cccJPAの同時実行制御とロック20140518 #ccc_r15 #jjug_ccc
JPAの同時実行制御とロック20140518 #ccc_r15 #jjug_cccMasatoshi Tada
 
NetBeansでかんたんJava EE ○分間クッキング! #kuwaccho lt
NetBeansでかんたんJava EE ○分間クッキング! #kuwaccho ltNetBeansでかんたんJava EE ○分間クッキング! #kuwaccho lt
NetBeansでかんたんJava EE ○分間クッキング! #kuwaccho ltMasatoshi Tada
 
Java EE 8先取り!MVC 1.0入門 [EDR2対応版] 2015-10-10更新
Java EE 8先取り!MVC 1.0入門 [EDR2対応版] 2015-10-10更新Java EE 8先取り!MVC 1.0入門 [EDR2対応版] 2015-10-10更新
Java EE 8先取り!MVC 1.0入門 [EDR2対応版] 2015-10-10更新Masatoshi Tada
 
はまる!JPA(初学者向けライト版)
はまる!JPA(初学者向けライト版)はまる!JPA(初学者向けライト版)
はまる!JPA(初学者向けライト版)Masatoshi Tada
 
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2Masatoshi Tada
 
Multibranch pipelineでいろいろ学んだこと
Multibranch pipelineでいろいろ学んだことMultibranch pipelineでいろいろ学んだこと
Multibranch pipelineでいろいろ学んだことaha_oretama
 
マルチクラウドデータ連携Javaアプリケーションの作り方
マルチクラウドデータ連携Javaアプリケーションの作り方マルチクラウドデータ連携Javaアプリケーションの作り方
マルチクラウドデータ連携Javaアプリケーションの作り方CData Software Japan
 
日本 Java ユーザーグループ JJUG CCC 2015 Fall by ソラコム 片山
日本 Java ユーザーグループ JJUG CCC 2015 Fall  by ソラコム 片山 日本 Java ユーザーグループ JJUG CCC 2015 Fall  by ソラコム 片山
日本 Java ユーザーグループ JJUG CCC 2015 Fall by ソラコム 片山 SORACOM,INC
 
Java8 Stream APIとApache SparkとAsakusa Frameworkの類似点・相違点
Java8 Stream APIとApache SparkとAsakusa Frameworkの類似点・相違点Java8 Stream APIとApache SparkとAsakusa Frameworkの類似点・相違点
Java8 Stream APIとApache SparkとAsakusa Frameworkの類似点・相違点hishidama
 
Javaにおけるネイティブコード連携の各種手法の紹介
Javaにおけるネイティブコード連携の各種手法の紹介Javaにおけるネイティブコード連携の各種手法の紹介
Javaにおけるネイティブコード連携の各種手法の紹介khisano
 
プログラム初心者がWebサービスをリリースして運営するまで
プログラム初心者がWebサービスをリリースして運営するまでプログラム初心者がWebサービスをリリースして運営するまで
プログラム初心者がWebサービスをリリースして運営するまでTomoaki Iwasaki
 
【こっそり始める】Javaプログラマコーディングマイグレーション
【こっそり始める】Javaプログラマコーディングマイグレーション【こっそり始める】Javaプログラマコーディングマイグレーション
【こっそり始める】Javaプログラマコーディングマイグレーションyy yank
 
よくある業務開発の自動化事情 #jjug_ccc #ccc_cd3
よくある業務開発の自動化事情 #jjug_ccc #ccc_cd3よくある業務開発の自動化事情 #jjug_ccc #ccc_cd3
よくある業務開発の自動化事情 #jjug_ccc #ccc_cd3irof N
 
Real world machine learning with Java for Fumankaitori.com
Real world machine learning with Java for Fumankaitori.comReal world machine learning with Java for Fumankaitori.com
Real world machine learning with Java for Fumankaitori.comMathieu Dumoulin
 
Java8移行から始めた技術的負債との戦い(jjug ccc 2015 fall)
Java8移行から始めた技術的負債との戦い(jjug ccc 2015 fall)Java8移行から始めた技術的負債との戦い(jjug ccc 2015 fall)
Java8移行から始めた技術的負債との戦い(jjug ccc 2015 fall)sogdice
 
デバッガのしくみ(JDI)を学んでみよう
デバッガのしくみ(JDI)を学んでみようデバッガのしくみ(JDI)を学んでみよう
デバッガのしくみ(JDI)を学んでみようfukai_yas
 

Viewers also liked (20)

Spring Bootの本当の理解ポイント #jjug
Spring Bootの本当の理解ポイント #jjugSpring Bootの本当の理解ポイント #jjug
Spring Bootの本当の理解ポイント #jjug
 
Java EEハンズオン資料 JJUG CCC 2015 Fall
Java EEハンズオン資料 JJUG CCC 2015 FallJava EEハンズオン資料 JJUG CCC 2015 Fall
Java EEハンズオン資料 JJUG CCC 2015 Fall
 
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
 
Java SE 9の紹介: モジュール・システムを中心に
Java SE 9の紹介: モジュール・システムを中心にJava SE 9の紹介: モジュール・システムを中心に
Java SE 9の紹介: モジュール・システムを中心に
 
JPAの同時実行制御とロック20140518 #ccc_r15 #jjug_ccc
JPAの同時実行制御とロック20140518 #ccc_r15 #jjug_cccJPAの同時実行制御とロック20140518 #ccc_r15 #jjug_ccc
JPAの同時実行制御とロック20140518 #ccc_r15 #jjug_ccc
 
NetBeansでかんたんJava EE ○分間クッキング! #kuwaccho lt
NetBeansでかんたんJava EE ○分間クッキング! #kuwaccho ltNetBeansでかんたんJava EE ○分間クッキング! #kuwaccho lt
NetBeansでかんたんJava EE ○分間クッキング! #kuwaccho lt
 
Java EE 8先取り!MVC 1.0入門 [EDR2対応版] 2015-10-10更新
Java EE 8先取り!MVC 1.0入門 [EDR2対応版] 2015-10-10更新Java EE 8先取り!MVC 1.0入門 [EDR2対応版] 2015-10-10更新
Java EE 8先取り!MVC 1.0入門 [EDR2対応版] 2015-10-10更新
 
はまる!JPA(初学者向けライト版)
はまる!JPA(初学者向けライト版)はまる!JPA(初学者向けライト版)
はまる!JPA(初学者向けライト版)
 
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
 
Multibranch pipelineでいろいろ学んだこと
Multibranch pipelineでいろいろ学んだことMultibranch pipelineでいろいろ学んだこと
Multibranch pipelineでいろいろ学んだこと
 
マルチクラウドデータ連携Javaアプリケーションの作り方
マルチクラウドデータ連携Javaアプリケーションの作り方マルチクラウドデータ連携Javaアプリケーションの作り方
マルチクラウドデータ連携Javaアプリケーションの作り方
 
日本 Java ユーザーグループ JJUG CCC 2015 Fall by ソラコム 片山
日本 Java ユーザーグループ JJUG CCC 2015 Fall  by ソラコム 片山 日本 Java ユーザーグループ JJUG CCC 2015 Fall  by ソラコム 片山
日本 Java ユーザーグループ JJUG CCC 2015 Fall by ソラコム 片山
 
Java8 Stream APIとApache SparkとAsakusa Frameworkの類似点・相違点
Java8 Stream APIとApache SparkとAsakusa Frameworkの類似点・相違点Java8 Stream APIとApache SparkとAsakusa Frameworkの類似点・相違点
Java8 Stream APIとApache SparkとAsakusa Frameworkの類似点・相違点
 
Javaにおけるネイティブコード連携の各種手法の紹介
Javaにおけるネイティブコード連携の各種手法の紹介Javaにおけるネイティブコード連携の各種手法の紹介
Javaにおけるネイティブコード連携の各種手法の紹介
 
プログラム初心者がWebサービスをリリースして運営するまで
プログラム初心者がWebサービスをリリースして運営するまでプログラム初心者がWebサービスをリリースして運営するまで
プログラム初心者がWebサービスをリリースして運営するまで
 
【こっそり始める】Javaプログラマコーディングマイグレーション
【こっそり始める】Javaプログラマコーディングマイグレーション【こっそり始める】Javaプログラマコーディングマイグレーション
【こっそり始める】Javaプログラマコーディングマイグレーション
 
よくある業務開発の自動化事情 #jjug_ccc #ccc_cd3
よくある業務開発の自動化事情 #jjug_ccc #ccc_cd3よくある業務開発の自動化事情 #jjug_ccc #ccc_cd3
よくある業務開発の自動化事情 #jjug_ccc #ccc_cd3
 
Real world machine learning with Java for Fumankaitori.com
Real world machine learning with Java for Fumankaitori.comReal world machine learning with Java for Fumankaitori.com
Real world machine learning with Java for Fumankaitori.com
 
Java8移行から始めた技術的負債との戦い(jjug ccc 2015 fall)
Java8移行から始めた技術的負債との戦い(jjug ccc 2015 fall)Java8移行から始めた技術的負債との戦い(jjug ccc 2015 fall)
Java8移行から始めた技術的負債との戦い(jjug ccc 2015 fall)
 
デバッガのしくみ(JDI)を学んでみよう
デバッガのしくみ(JDI)を学んでみようデバッガのしくみ(JDI)を学んでみよう
デバッガのしくみ(JDI)を学んでみよう
 

Similar to Java EE Action-Based MVC with Thymeleaf

Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET WebskillsCaleb Jenkins
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)Hendrik Ebbers
 
Top 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeTop 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeMark Meyer
 
Spring MVC Intro / Gore - Nov NHJUG
Spring MVC Intro / Gore - Nov NHJUGSpring MVC Intro / Gore - Nov NHJUG
Spring MVC Intro / Gore - Nov NHJUGTed Pennings
 
Introduction to ASP.NET MVC 2
Introduction to ASP.NET MVC 2Introduction to ASP.NET MVC 2
Introduction to ASP.NET MVC 2Joe Wilson
 
Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Massimo Oliviero
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
.NET Coding Standards For The Real World (2012)
.NET Coding Standards For The Real World (2012).NET Coding Standards For The Real World (2012)
.NET Coding Standards For The Real World (2012)David McCarter
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'sAntônio Roberto Silva
 
AngularJS for Web and Mobile
 AngularJS for Web and Mobile AngularJS for Web and Mobile
AngularJS for Web and MobileRocket Software
 
Dsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaDsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaUgo Matrangolo
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
AWS Summit DC 2021: Improve the developer experience with AWS CDK
AWS Summit DC 2021: Improve the developer experience with AWS CDKAWS Summit DC 2021: Improve the developer experience with AWS CDK
AWS Summit DC 2021: Improve the developer experience with AWS CDKCasey Lee
 
It's always your fault. Poznań ADG 2016
It's always your fault. Poznań ADG 2016It's always your fault. Poznań ADG 2016
It's always your fault. Poznań ADG 2016Przemek Jakubczyk
 
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...Fwdays
 
Up and Running with Angular
Up and Running with AngularUp and Running with Angular
Up and Running with AngularJustin James
 

Similar to Java EE Action-Based MVC with Thymeleaf (20)

Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET Webskills
 
ASP .Net MVC 5
ASP .Net MVC 5ASP .Net MVC 5
ASP .Net MVC 5
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)
 
Top 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeTop 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers Make
 
Spring MVC Intro / Gore - Nov NHJUG
Spring MVC Intro / Gore - Nov NHJUGSpring MVC Intro / Gore - Nov NHJUG
Spring MVC Intro / Gore - Nov NHJUG
 
Introduction to ASP.NET MVC 2
Introduction to ASP.NET MVC 2Introduction to ASP.NET MVC 2
Introduction to ASP.NET MVC 2
 
Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
.NET Coding Standards For The Real World (2012)
.NET Coding Standards For The Real World (2012).NET Coding Standards For The Real World (2012)
.NET Coding Standards For The Real World (2012)
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
AngularJS for Web and Mobile
 AngularJS for Web and Mobile AngularJS for Web and Mobile
AngularJS for Web and Mobile
 
Dsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaDsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in Scala
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
AWS Summit DC 2021: Improve the developer experience with AWS CDK
AWS Summit DC 2021: Improve the developer experience with AWS CDKAWS Summit DC 2021: Improve the developer experience with AWS CDK
AWS Summit DC 2021: Improve the developer experience with AWS CDK
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
It's always your fault. Poznań ADG 2016
It's always your fault. Poznań ADG 2016It's always your fault. Poznań ADG 2016
It's always your fault. Poznań ADG 2016
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
 
Up and Running with Angular
Up and Running with AngularUp and Running with Angular
Up and Running with Angular
 

More from Masatoshi Tada

Java ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugJava ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugMasatoshi Tada
 
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetupこれで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
これで怖くない!?コードリーディングで学ぶSpring Security #中央線MeetupMasatoshi Tada
 
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_cccPivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_cccMasatoshi Tada
 
基礎からのOAuth 2.0とSpring Security 5.1による実装
基礎からのOAuth 2.0とSpring Security 5.1による実装基礎からのOAuth 2.0とSpring Security 5.1による実装
基礎からのOAuth 2.0とSpring Security 5.1による実装Masatoshi Tada
 
初めてでも30分で分かるSpring 5 & Spring Boot 2オーバービュー
初めてでも30分で分かるSpring 5 & Spring Boot 2オーバービュー初めてでも30分で分かるSpring 5 & Spring Boot 2オーバービュー
初めてでも30分で分かるSpring 5 & Spring Boot 2オーバービューMasatoshi Tada
 
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説Masatoshi Tada
 
Java EE 8新機能解説 -Bean Validation 2.0編-
Java EE 8新機能解説 -Bean Validation 2.0編-Java EE 8新機能解説 -Bean Validation 2.0編-
Java EE 8新機能解説 -Bean Validation 2.0編-Masatoshi Tada
 
JSUG SpringOne 2017報告会
JSUG SpringOne 2017報告会JSUG SpringOne 2017報告会
JSUG SpringOne 2017報告会Masatoshi Tada
 
とにかく分かりづらいTwelve-Factor Appの解説を試みる
とにかく分かりづらいTwelve-Factor Appの解説を試みるとにかく分かりづらいTwelve-Factor Appの解説を試みる
とにかく分かりづらいTwelve-Factor Appの解説を試みるMasatoshi Tada
 
Java EEでもOAuth 2.0!~そしてPayara Micro on Cloud Foundryで遊ぶ~
Java EEでもOAuth 2.0!~そしてPayara Micro on Cloud Foundryで遊ぶ~Java EEでもOAuth 2.0!~そしてPayara Micro on Cloud Foundryで遊ぶ~
Java EEでもOAuth 2.0!~そしてPayara Micro on Cloud Foundryで遊ぶ~Masatoshi Tada
 
Spring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsugSpring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsugMasatoshi Tada
 

More from Masatoshi Tada (11)

Java ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugJava ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsug
 
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetupこれで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
 
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_cccPivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
 
基礎からのOAuth 2.0とSpring Security 5.1による実装
基礎からのOAuth 2.0とSpring Security 5.1による実装基礎からのOAuth 2.0とSpring Security 5.1による実装
基礎からのOAuth 2.0とSpring Security 5.1による実装
 
初めてでも30分で分かるSpring 5 & Spring Boot 2オーバービュー
初めてでも30分で分かるSpring 5 & Spring Boot 2オーバービュー初めてでも30分で分かるSpring 5 & Spring Boot 2オーバービュー
初めてでも30分で分かるSpring 5 & Spring Boot 2オーバービュー
 
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
 
Java EE 8新機能解説 -Bean Validation 2.0編-
Java EE 8新機能解説 -Bean Validation 2.0編-Java EE 8新機能解説 -Bean Validation 2.0編-
Java EE 8新機能解説 -Bean Validation 2.0編-
 
JSUG SpringOne 2017報告会
JSUG SpringOne 2017報告会JSUG SpringOne 2017報告会
JSUG SpringOne 2017報告会
 
とにかく分かりづらいTwelve-Factor Appの解説を試みる
とにかく分かりづらいTwelve-Factor Appの解説を試みるとにかく分かりづらいTwelve-Factor Appの解説を試みる
とにかく分かりづらいTwelve-Factor Appの解説を試みる
 
Java EEでもOAuth 2.0!~そしてPayara Micro on Cloud Foundryで遊ぶ~
Java EEでもOAuth 2.0!~そしてPayara Micro on Cloud Foundryで遊ぶ~Java EEでもOAuth 2.0!~そしてPayara Micro on Cloud Foundryで遊ぶ~
Java EEでもOAuth 2.0!~そしてPayara Micro on Cloud Foundryで遊ぶ~
 
Spring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsugSpring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsug
 

Recently uploaded

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Recently uploaded (20)

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

Java EE Action-Based MVC with Thymeleaf

  • 1. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Getting Start Java EE Action-Based MVC With Thymeleaf Masatoshi Tada (Casareal ,Inc) JJUG CCC 2016 Spring 2016-5-21(Sat) 1
  • 2. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. About This Session ! Answer Your Question "Java EE is Useful Framework As Next Struts?" ! View is Thymeleaf ! ! Code on GitHub ! https://github.com/MasatoshiTada/jjug-action-based- mvc ! Sorry, comments are written in Japanese 2
  • 3. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. About Me ! Masatoshi Tada !Casareal, Inc !GlassFish User Group Japan !Trainer(Java EE/Spring/Swift) !Twitter:@suke_masa 3
  • 4. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Agenda ① What’s "Action-Based MVC"? ② Getting Start MVC 1.0(EE 8) ③ Using Jersey MVC & RESTEasy HTML in EE 7 ④ Other Java EE Technologies You Should Know ⑤ Final Conclusions 4
  • 5. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ①What’s "Action-Based MVC"? 5
  • 6. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. What’s Action-Based MVC? ! Web Framework which focuses HTTP request & response ! Most of framework are Action-Based ! Struts, Spring MVC, … 6
  • 7. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. What’s Action-Based MVC? 7 View View Controller Model request response Struts developer friendly
  • 8. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. What’s "Component-Based MVC"? 8 View Backing Bean Model GUI(VB, Android…) developer friendly -> Struts developer Un-Friendly
  • 9. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Web Framework of Java EE ! JSF ! Responses HTML ! Component-Based ! JAX-RS ! Responses JSON/XML ! Action-Based 9 There’s no Framework which is "Action-Based" and "Responses HTML"
  • 10. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Java EE Standard Action-Based MVC!! ! Model-View-Controller API (MVC 1.0) ! Java EE 8 (2017 H1) ! Based on JAX-RS 10
  • 11. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ②Getting Start MVC 1.0 11
  • 12. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. MVC 1.0 ! MVC 1.0 is Specification ! ≒Set of Interfaces, Annotations, and Exceptions ! Reference Implementation is Ozark ! Set of Implementation Classes of above interfaces 12
  • 13. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Main Functions of Struts ! Controller ! Validation ! Handling Exception ! View Technology ! Transaction Token 13
  • 14. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. in MVC 1.0? ! Controller → ⭕ ! Validation → ⭕ ! Handling Exception → ⭕ ! View Technology → ❌ ! Transaction Token → ❌ 14
  • 15. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Why No View Technologies in MVC? ! Non-Goal 1 of MVC specification
 "Define a new view (template) language and processor." ! Instead, MVC provides integration with many view technologies! 15
  • 16. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. View Technologies We Can Use in MVC 1.0 ! MVC ! JSP, Facelets ! Ozark ! Thymeleaf, Mustache, Freemarker,
 Handlerbars, Velocity, AsciiDoc, … 16 If you want to use other View, Implement ViewEngine interface
  • 17. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Problems of JSP and Facelets 17 ! JSP ! Mix of Logic and View ! Sometime Occurs XSS ! Facelets ! Cannot Use All Features in MVC 1.0 ! Bad Compatibility with JavaScript
  • 18. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Let’s Use Thymeleaf! 18 ! Pure HTML! ! Isolate View and Logic absolutely! ! Good Compatibility with JavaScript! ! Link Expression is very useful! ! Internationalizing message! ! http://www.thymeleaf.org/doc/tutorials/2.1/ usingthymeleaf.html#a-multi-language-welcome
  • 19. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Using Thymeleaf in MVC 1.0 19 <dependency> <groupId>org.glassfish.ozark.ext</groupId> <artifactId>ozark-thymeleaf</artifactId> <version>1.0.0-m02</version> <scope>compile</scope> </dependency> ! Just adding dependency like below
  • 20. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Why No Transaction Token Feature? ! In Expert Group’s Mailing-List, 
 "This is a client side concern" ! https://java.net/projects/mvc-spec/lists/ jsr371-experts/archive/2015-07/message/2 ! Spring MVC has no transaction token feature, too. 20
  • 21. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. How to Avoid Double-Submit-Problem ! See TERASOLUNA Guideline ! http://terasolunaorg.github.io/guideline/ 5.1.0.RELEASE/en/ArchitectureInDetail/ DoubleSubmitProtection.html 21
  • 22. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Preparation : Enabling JAX-RS 22 @ApplicationPath("/api") public class MyApplication extends Application { } Inherit Application class Add Annotation jjug-mvc10/src/main/java/com/example/rest/MyApllication.java
  • 23. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Basic Controller 23 @Path("/employee") public class EmployeeController { @GET @Path("/index") @Controller public String index() { return "employee/index.html"; } } Path of View (extention is REQUIRED) Indicate as controller method Mapping to URL & HTTP method ※Italic is feature of MVC jjug-mvc10/src/main/java/com/example/rest/controller/EmployeeController.java
  • 24. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Form Class 24 public class EmployeeIdForm { @QueryParam("id") @NotBlank @Pattern(regexp = "[1-9][0-9]*") private String id; // setter/getter } Mapping to "id" Query Parameter Constraint of Bean Validation jjug-mvc10/src/main/java/com/example/rest/form/EmployeeIdForm.java
  • 25. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Send Object to View 25 public class EmployeeController { @Inject private Models models; @GET @Path("/result") @Controller @ValidateOnExecution(type=ExecutableType.NONE) public String result(…) { models.put("employee", employee); return "employee/result.html"; } Box of Object (Map + Iterator) Object referred by View jjug-mvc10/src/main/java/com/example/rest/controller/EmployeeController.java ※Italic is feature of MVC
  • 26. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Referring Object in View 26 <table th:unless="${employee == null}"> <tr th:object="${employee}"> <td th:text="*{empId}">99999</td> <td th:text="*{name}">Taro Yamada</td> <td th:text="*{joinedDate}">2020-01-01</td> <td th:text="*{department.deptId}">99</td> <td th:text="*{department.name}">Admin</td> </tr> </table> WEB-INF/views is view folder jjug-mvc10/src/main/webapp/WEB-INF/views/employee/result.html Name put to Models
  • 27. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Validation 27 public class EmployeeController { @Inject private BindingResult br; @GET @Path("/result") @Controller @ValidateOnExecution(type=ExecutableType.NONE) public String result( @Valid @BeanParam EmployeeIdForm form) { if (br.isFailed()) { models.put("bindingResult", br); return "employee/index.html"; // To input view Box of Messages Enable Validation Error Processing jjug-mvc10/src/main/java/com/example/rest/controller/EmployeeController.java ※Italic is feature of MVC
  • 28. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Showing Error Messages 28 <ul th:if="${bindingResult != null}"> <li th:each="message : ${bindingResult.allMessages}" th:text="${message}"> This is Dummy Message </li> </ul> Get Messages From BindingResult jjug-mvc10/src/main/webapp/WEB-INF/views/employee/index.html
  • 29. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Writing Error Messages ! Write messages in 
 src/main/resources/ ValidationMessages.properties ! Specify Key of Message to "message" attribute in Annotation 29
  • 30. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Specifying Error Message Key 30 public class EmployeeIdForm { @QueryParam("id") @NotBlank(message = "{id.notblank}") @Pattern(regexp = "[1-9][0-9]*", message = "{id.pattern}") private String id; // setter/getter Key of Message with "{}" jjug-mvc10/src/main/java/com/example/rest/form/EmployeeIdForm.java
  • 31. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Caution : MVC has No "Form-Binding" Feature ! @BeanParam is not "Form-Binding" ! On error, If You want to leave values in input-components on view, Write view as Next 31
  • 32. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Implementing Form-Binding 32 <form action="./result" method="get"> <input type="text" name="id" value="" th:value="${param.id == null} ? '' : ${param.id[0]}"/> <input type="submit" value="search"/> </form> jjug-mvc10/src/main/webapp/WEB-INF/views/employee/index.html Maybe Complex with selectbox …
  • 33. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Handling Exception ! Implement ExceptionMapper interface ! When error occurs, ExceptionMapper catches Exception ! You can implement multiple ExceptionMappers 33
  • 34. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ExceptionMapper class 34 @Provider public class ExceptionMapper implements javax.ws.rs.ext.ExceptionMapper<Exception> { public Response toResponse( Exception exception) { // Forward to Error View… } } Don’t Forget @Provider Catches Exception as Method Argument Implement ExceptionMapper
  • 35. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Other Features of MVC ! Security (XSS, CSRF) ! File Upload, Download ! MvcContext (Easy Specifying URL) ! Hybrid Class (HTML and REST) ! More Details, See GUGJ Slides below ! http://www.slideshare.net/masatoshitada7/java-ee-8mvc-10 35
  • 36. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Conclusions of this chapter ! MVC 1.0 + Thymeleaf covers almost features of Struts! ! Need to implement Transaction Token and Form-Binding By Yourself ! Features of MVC are Simple, Reveraging existing Java EE Features. 36
  • 37. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ③Using Jersey MVC & RESTEasy HTML in EE 7 37
  • 38. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. What framework should we use in Java EE 7? ! MVC 1.0 is Java EE 8 ! Java EE 8 will be released in 2017 H1 38 Let’s use Jersey MVC or RESTEasy HTML in EE7!
  • 39. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. What’s Jersey MVC? ! Original Extension of Jersey(JAX-RS RI) ! Similar to MVC 1.0 ! GlassFish/Payara inside ! WebLogic not inside 39
  • 40. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. What’s RESTEasy HTML? ! Original Extension of RESTEasy (other implementation of JAX-RS) ! RESTEasy is inside WildFly/JBoss,
 but RESTEasy HTML is not inside 40
  • 41. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Basic Jersey MVC ! Register MvcFeature class to Your Application sub class (ResourceConfig is Convinient) 41 @ApplicationPath("/api") public class MyApplication extends ResourceConfig { public MyApplication() { register(MvcFeature.class); property(MvcFeature.TEMPLATE_BASE_PATH, "/WEB-INF/views/"); packages(true, "com.example.rest"); } } jjug-jersey-mvc/src/main/java/com/example/rest/MyApplication.java ※Italic is Jersey MVC’s feature
  • 42. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Basic Jersey MVC ! Return Viewable in controller methods 42 @Path("/employee") public class EmployeeController { @GET @Path("/index") public ThymeleafViewable index(…) { return new ThymeleafViewable( "employee/index.html"); } } My original class (Viewable’s subclass) jjug-jersey-mvc/src/main/java/com/example/rest/controller/EmployeeControler.java ※Italic is Jersey MVC’s feature
  • 43. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Basic Jersey MVC ! Add value to Viewable constructor’s 2nd parameter 43 @Path("/employee") public class EmployeeController { @GET @Path("/result") public ThymeleafViewable result(…) { Map<String, Object> models = … return new ThymeleafViewable( "employee/result.html", models); } Put objects to Map jjug-jersey-mvc/src/main/java/com/example/rest/controller/EmployeeControler.java ※Italic is Jersey MVC’s feature
  • 44. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. How to Use Thymeleaf with Jersey MVC ! Implment TemplateProcessor interface (Provided by Jersey) ! AbstractTemplateProcessor class is useful ! implementation of TemplateProcessor 44
  • 45. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ThymeleafTemplateProcessor 45 @Provider public class ThymeleafTemplateProcessor extends AbstractTemplateProcessor<String> { private TemplateEngine templateEngine; @Inject public ThymeleafTemplateProcessor( Configuration config, ServletContext servletContext) { super(config, servletContext, "html", "html"); TemplateResolver templateResolver = new ServletContextTemplateResolver(); templateResolver.setPrefix((String) config.getProperty( MvcFeature.TEMPLATE_BASE_PATH)); templateEngine = new TemplateEngine(); templateEngine.setTemplateResolver(templateResolver); } // to next slide jjug-jersey-mvc/src/main/java/com/example/rest /thymeleaf/ThymeleafTemplateProcessor.java ※Italic is Jersey MVC’s feature
  • 46. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ThymeleafTemplateProcessor 46 // 続き @Override public void writeTo(...) { WebContext webContext = new WebContext( request, response, servletContext, request.getLocale()); Map<String, Object> map = (Map) viewable.getModel(); webContext.setVariables(map); templateEngine.process(viewable.getTemplateName(), webContext, response.getWriter()); } } jjug-jersey-mvc/src/main/java/com/example/rest /thymeleaf/ThymeleafTemplateProcessor.java Thymeleaf write the response ※Italic is Jersey MVC’s feature
  • 47. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Validation in Jersey MVC ! Jersey provides @ErrorTemplate annotation to specify error view, but… ! This annotation is feature for handling exception (not for validation) ! MVC 1.0 doesn’t have similar feature, so migration will be difficult ! Cannot use "Validation Group" and "Group Sequence" (Features of Bean Validation) 47
  • 48. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Validate in Controller Methods 48 @Inject Validator validator; @GET @Path("/result") public ThymeleafViewable result( @BeanParam EmployeeIdForm form) { Set<ConstraintViolation<EmployeeIdForm>> violations = validator.validate(form); if (!violations.isEmpty()) { Map<String, Object> model = …; model.put("violations", violations); return new ThymeleafViewable( "employee/index.html", model); } Execute Bean Validation No @Valid to arguments Validate On error, return to input view
  • 49. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Showing Error Message 49 <ul th:if="${violations != null}"> <li th:each="violation : ${violations}" th:text="${violation.message}"> This is Dummy Message </li> </ul>
  • 50. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. About This Method ! Advantage ! Pure JAX-RS code ! Easy MVC 1.0 migration ! Avoid excess framework customization ! Disadvantage ! It takes time and effort 50 I Tried a variety of methods, this method is best
  • 51. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Handling Exception ! ExceptionMapper ! Same to MVC 1.0 sample code 51
  • 52. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Redirect ! JAX-RSのコードで書けばOK 52 @GET @Path("/redirect") public Response redirect( @Context UriInfo uriInfo) throws Exception { URI location = uriInfo.getBaseUriBuilder() .path(HelloResource.class) .path("redirect2") .build(); return Response.status(Response.Status.FOUND) .location(location).build(); } UriInfo has variety of method to build URI Specify URI to Location header Status code 3xx
  • 53. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Basic RESTEasy HTML ! Create Application’s sub class ! No need to register any specific class ! By JAX-RS "Providers" 53 @ApplicationPath("/api") public class MyApplication extends Application { } jjug-resteasy-html/src/main/java/com/example/rest/MyApplication.java
  • 54. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Basic RESTEasy HTML ! Return Renderable in controller method 54 <<interface>> Renderable View class (Forward) Redirect class (Redirect)
  • 55. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Using Thymeleaf in RESTEasy HTML ! Create Renderable implementation class 55 <<interface>> Renderable View Redirect ThymeleafView
  • 56. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ThymeleafView 56 public class ThymeleafView implements Renderable { private String templateName; private Map<String, Object> models; private TemplateEngine templateEngine; public ThymeleafView(String templateName) { this(templateName, new HashMap<>()); } public ThymeleafView(String templateName, Map<String, Object> models) { this.templateName = templateName; this.models = models; } void setTemplateEngine(TemplateEngine templateEngine) { this.templateEngine = templateEngine; } Implement Renderable ※Italic is RESTEasy HTML feature
  • 57. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ThymeleafView 57 // from previous slide @Override public void render(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, WebApplicationException { response.setCharacterEncoding("UTF-8"); WebContext webContext = new WebContext( request, response, request.getServletContext(), request.getLocale()); webContext.setVariables(models); templateEngine.process(templateName, webContext, response.getWriter()); } } Call TemplateEngine#process() in render() ※Italic is RESTEasy HTML feature
  • 58. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Creating Interceptor Setting TemplateEngine to ThymeleafView ! Use JAX-RS WriterInterceptor ! Create custom annotation with NameBinding, to specify which controller apply interceptor ! There’re many ways(This is not only way) 58
  • 59. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Creating annotation 59 @NameBinding @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) @Documented public @interface ThymeleafController { } Create annotation with @NameBinding
  • 60. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Creating WriterInterceptor 60 @Provider @ThymeleafController public class ThymeleafWriterInterceptor implements WriterInterceptor { private TemplateEngine templateEngine; @PostConstruct public void init() { TemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/views/"); templateEngine = new TemplateEngine(); templateEngine.setTemplateResolver(resolver); } Specify annotation you created Implement WriterInterceptor
  • 61. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Creating WriterInterceptor 61 @Override public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { Object entity = context.getEntity(); if (ThymeleafView.class.isAssignableFrom(entity.getClass())) { ThymeleafView thymeleafView = (ThymeleafView) context.getEntity(); thymeleafView.setTemplateEngine(templateEngine); } context.proceed(); } } Set TemplateEngine before context.proceed()
  • 62. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Controller 62 @GET @Path("result") @ThymeleafController public ThymeleafView result(…) { Map<String, Object> models = …; models.put("employee", employee); return new ThymeleafView( "employee/result.html", models); } Specify annotation →Applying interceptor View path and values ※Italic is RESTEasy HTML feature
  • 63. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Validation and Handling Exception ! Same as Jersey MVC sample code 63
  • 64. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Conclusions of this chapter ! In Java EE 7, 
 Use Jersey MVC or RESTEasy HTML! ! Controller methods, views and handling exceptions are same as MVC 1.0! ! They have no BindingResult, so validate in controller methods! 64
  • 65. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ④Other Java EE Technologies You Should Know 65
  • 66. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. JAX-RS ! Specific features of MVC 1.0/Jersey MVC/ RESTEasy HTML are not many ! To achieve what you want to do, and trouble-shooting, knowledge of JAX-RS is very important 66
  • 67. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. JAX-RS Reference ! JSR-339 JAX-RS 2.0 rev.A ! You should learn Processing Pipeline
 (Appendix C) ! https://jcp.org/en/jsr/detail?id=339 ! Jersey Document ! RESTEasy Document 67
  • 68. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Others ! Bean Validation ! CDI ! JPA 68
  • 69. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. ⑤Final Conclusions 69
  • 70. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Final Conclusions ! MVC 1.0 + Thymeleaf covers almost features of Struts! ! In EE 7, Use Jersey MVC or RESTEasy HTML! ! Understanding JAX-RS is very important! 70
  • 71. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Caution ! Jersey MVC and RESTEasy HTML are 
 NOT "Java EE 7 standard" ! They will be out of range 
 of server vendors’ support ! In "Java EE 7 standard", 
 JSF is the ONLY HTML Framework 71
  • 72. #ccc_cd4 (C) CASAREAL, Inc. All rights reserved. Enjoy Java EE!! ! Thank you! 72