May 8, 2016
Additionally, there’s the new action based MVC framework coming for Java EE 8, which allows not only to write cool applications, but also writing own
ReactViewEngine implementation is done for the Ozark reference implmentation, but has no direct/hard dependencies to Ozark packages, so it can be used together with any other JSR-371 implementation (as soon as there are some available).
The right tool: Webpack
How it works
I give you a short overview, about how the things working in my
ReactViewEngine identifies from the
ReactController. This controller provides also the appropriate data which should be used during rendering. The
ReactViewEngine delegates for the actual rendering process to the
All the JSX files will be packaged by Webpack during build to the application bundle
app.js, which contains all the needed code - our own application logic as well as all the React functions. The main difference for client- or server-side rendering are the functions
renderClient(), which trigger the rendering process for the appropriate platform.
Last but not least, there’s the HTML template
react.jsp (for the ease of use, I took a JSP) which provides the HTML skeleton for the needed resources in the browser. Mainly the
<div> element where to put the rendered content by React (and some other resources we need to get a nice looking webapp, like CSS and something similar).
The result is the web application you can see in the screenshot at the top of this post. That’s it, no magic, just the proper use of technologies which fit together very well.
A word on Isomorphic vs. Universal
There are several opinions out there on the terms and definitions of “Isomorphic” and “Universal”. I don’t really care about which term to use, there’s no favorite for me, just use whatever you like and don’t complain..