Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Utilizing JSF Front Ends with Microservices
1. Utilizing JSF
Front Ends w Microservices
Code Smarter
Josh Juneau
Apress and Java Magazine Author
JCP Member, Apache NetBeans Contributor,
Java Champion, Jakarta EE Ambassadors
2. About Me
• Developer, DBA, System Administrator
• Author, Speaker, Podcaster
• Java Champion
• Apache NetBeans Developer
• Jakarta EE Ambassadors
3. Agenda
• Primer on newer features of Jakarta Server
Faces and Jakarta RESTful Web Services
• Simple services utilizing Jakarta EE
specifications.
• Basic Jakarta Server Faces front end to
display and update data via RESTful web
services.
• Incorporation of JSF frameworks to build
robust front ends.
4. How to Get Started
Today
• Download Eclipse GlassFish 5.1.0 (Utilize Payara
5.194+ for JDK 11 support)
• https://projects.eclipse.org/projects/
ee4j.glassfish
• Include Jakarta EE 8 dependencies into your
project
• Great examples:
• https://github.com/juneau001/JakartaEE-Playground
• https://projects.eclipse.org/projects/ee4j.jakartaee-platform/
5. Jakarta EE 8 Overview
• Continued enhancements for productivity
and web standards alignment
• Better alignment with Java SE 8
• Work towards a better platform for
development of microservices
6. Jakarta Server Faces
• Enhanced CDI
Alignment
• WebSocket
Integration
• Ajax Method
Invocation
• Class LevelValidation
• Java 8 Date-Time
• Iterable/Map/Custom
UIData Support
• Component Search
Expressions
• Radio Button
• styleclass on h:column
• Basic Support for
Extensionless URLs
New Features with 2.3
7. Utilize Date-Time API
Make use of the <f:convertDateTime /> tag.
New type attribute values on
<f:convertDateTime>:
• localDate, localTime, localDateTime
• offsetTime,offsetDateTime,
zonedDateTime
8. Jakarta Server Faces 3.0
• Removal of old cruft
• JSF’s own expression language
• Managed Beans
• Move more artifacts towards CDI
• Action Model (Not to compete with Krazo)
• Extensionless Mapping
9. Resource Injection
Inject JSF artifacts in JSF 2.3, and even
possible to inject into other JSF artifacts.
@Inject
private ExternalContext externalContext;
@Inject
private ServletContext servletContext;
10. How it Works
JSF 2.3 provides default producers for
many of the most commonly used JSF
artifacts, therefore, we can now inject
rather than hard-code.
Converters, validators and behaviors are
now also injection targets.
12. Jakarta API for RESTful
Web Services
• Improved CDI Integration
• Reactive Client API
• Non-Blocking I/O
• https://github.com/jax-rs/spec
13. • Server Sent Events
• One way communication channel
• Text protocol,“text/event-stream” media
type
• Multiple messages
• Retry interval
Jakarta API for RESTful
Web Services
15. Using JSF for Front End
• Model: Model Classes
• View: Facelets
• Controller: CDI Beans
• Wire together with Expression Language
16. Front End Service
• Utilize JAX-RS (RESTful Web Services) client
• All database work occurs within the
microservice (JPA, EJB if needed)
• Utilize JAX-RS to provide data to client
27. Summary
• Utilize microservices with JPA and JAX-RS
to build database communication
• Create front-ends using JSF, CDI, JAX-RS
• Utilize third party libraries for limitless
options