3. GWT development with
Errai and Forge
How to use the same development model on
client/server with Errai/Forge
4. Why GWT ?
● With the arise of AJAX and Web 2.0 GWT
is the only tool that allows a single
programming language on client and server
● The problem is that the development
environments (API and platform) are really
different
5. Here comes Errai
With Errai you can use a single model to
develop all your applications: Java EE 6 with its
CDI capabilities and its RESTful services
6. Optional Modules
● Automatic Data Binding between POJOs
and UI
● A template system that is far better than
UIBinder
● JPA for the WebSQL DB
● Also.....an optional simple and powerful
bidirectional Message Bus between the
client and the server
7. And what about Forge ?
When you start a new project you can:
● start from scratch, googling for configuration
and the initial code skeleton
● use a Maven Archetype (not really
interactive)
● use JBoss Forge to create the scaffold that
you really need in your project
8. Forge: developer's BASH
● It creates only applications that use standard
technologies (Java language, Java EE
programming model)
● No Forge APIs or configuration files on your
code
● Once your project is configured, you can
forget about Forge, or may use it as your
dev shell, your taste
10. CDI with Errai unveiled
● Create a GWT's EntryPoint with a simple
bean and the @EntryPoint annotation
● The @PostConstruct method will instruct
how to bootstrap your application
● You can do communication over the Errai
Bus using only CDI event
○ client code
○ server code
12. Errai JAX-RS
● Forge helps us creating the jax-rs setup
● You can call a RESTful end-point only using
jax-rs API within the CDI container
● You can use a Jackson-compatible
marshalling/unmarshalling JSON
14. Errai UI
● Put your HTML5 template into your Java
packages
● Annotate your Composite with @Templated
and you are done!
● You can also inject Widgets inside the
template and of course attach event to those
widgets
15. Errai Data Binding
● A POJO annotated with @Bindable can be
injected into a Composite as a DataBinder
● When the Composite is annotated with
@Templated then the binding betweeen
fields and widgets is implicit
● We can also register a custom Converter,
global or local to a property
17. Errai's Portable Objects
● We mark objects that need to travel between
client and server with the @Portable
annotation
● Many strategies for construction and
injection
● Same API on client and on server
18. Conclusions
● Forge helps us tailoring new projects for our
needs and working in a productive way on
existing ones
● Errai lets us write less and better code with a
common paradigm between client and server
● Errai has also many addional modules that
complete our client coding experience (HTML5
UI, Data Bindind, RESTful client)
19. References
● The History and Future of GWT: http://go o.gl/mwrOJ
● Innovation Award 2012, JBoss Forge: http://jax-awards.
com/proposal_technology.php?id=599&show=more
● Errai's project leader in the GWT Steering Committee:
http://googlewebtoolkit.blogspot.it/2012/09/gwt-survey.
html