This is a small example, which demonstrates how to integrate Eclipse RWT (the UI technology of Eclipse RAP) as a String Boot web application using Gradle as the build tool.
This example shows:
- how to declare the RWT and JFace dependencies in a Gradle build,
- how to integrate the moving parts of RWT with a Spring Boot web application (Spring MVC),
- how to leverage Spring managed beans, dependency injection and a pure programmatic way of configuring and wiring together an RWT application (no need for a web.xml),
- how to provide a menu,
- how to provide support to login (sample very simple using only one account with username "user" and password "user"),
- how to use buttons,
- how to use clickable Labels, i.e. links
This APP is compose of two main views the menu side on the left and the data side on the right. The menu side is compose of three distinctive areas a top one with the name of the APP, middle side with the menu, and a button side (footer) with the login/logout.
The menu provides five views, which are:
- Home: starting page, which does not require to be logged in to see it.
- First view: the first customised view, which requires to be logged in to see it.
- Second view: the second customised view, which requires to be logged in to see it.
- Third view: the third customised view, which requires to be logged in to see it.
- About: Some data about the application, which does not require to be logged in to see it.
If a view that requires to be logged in before it can be seen is selected/clicked and it is not already logged in then the login page is displayed. On successful logged in the previously selected/clicked view is displayed.
The login time out is set in the messages.properties file together with the text used in the UI. This timeout is in milliseconds, which indicate the maximum period of time the views requiring login will be visible and after which the application will logout and a new login will be required for those pages that require login.
Below is presented an screenshot of one of the pages of the UI.
The example is not sophisticated, but you should give an idea on using Eclipse RAP and String Boot.
Java 11 (or later)
You can use the Gradle wrapper that comes with the project to run the commands.
If you are on Windows, use gradlew.bat
instead.
gradlew bootRun
This Gradle command will build and run the application in an embedded Tomcat container. After the app has fully started, open a browser and visit http://localhost:8080/ or http://localhost:8080/main
Alternatively, you can use bootJar
to create a runnable standalone jar file with an embedded Tomcat container and run it like this:
gradlew bootJar
java -jar build/libs/rwtwithspringboot-0.0.1-SNAPSHOT.jar
To build a WAR file that you can deploy to a Tomcat container installation or run in a Docker image, simply use war
:
gradlew war
The resulting WAR file will be located in build/libs
.
- Fix the Home view when it's shown for first time.
- Implement the footer with button(s) part of the Card element.
- Add functionality to the Cards elements in the HomeView so when clicked the corresponding view is displayed.
- Add to other views some content.
- Add proper login authentication and authorisation.
- Add progress bar when logging in.
These additional references should also help you: