How-tos

With Vaadin Framework, create stunning Web UIs with plain Java

Share this post:

Vaadin Framework is a tool to build good looking Web apps without working with low-level Web technologies. The framework itself contains all the logic to create the modern Web app while you concentrate on the UI itself, using a familiar component based approach, almost like you’re building a traditional desktop app. In this article, we’ll look at two alternatives, along with really trimmed down examples, and a how-to-get-started with Java Web apps in Bluemix from scratch.

Screen shot collage of Vaadin Framework DashboardThe screenshot above is from the Dashboard demo.

Vaadin apps can be run in Bluemix easily, as Vaadin basically just requires a servlet container, like the WebSphere Liberty Profile which is available in Bluemix. We have previously covered using the Vaadin boilerplate application example, which builds on Java EE architecture, uses EJBs and JPA to access a traditional relational database. But not all apps need that kind of “enterprise grade” architecture.

Let’s get started!

Using the Vaadin Maven archetype

Vaadin logoThe first thing you will need to do is register for Bluemix, if you don’t already have an account. There is a 30-day free trial you use for the purposes of this blog article.

All IDE integrations in Vaadin are now based on Maven archetypes, which practically create for you the basic build scripts to create a war file and a simple “hello world” example code. The first step is to create such a project using our getting started instructions. Feel free to use either command line in the Maven or IDE approach.

Once you have the project ready and you have built the war file, you’ll need to push the WAR file to Bluemix. An easy way to do is with the Bluemix/CloudFoundry CLI tools. Unless you have already done it, follow the instructions on how to install and login to your account. Then, after the login, you can just apply the following command from the projects root directory:

cf push your-server-name -p target/*.war

Note that if you are using Windows, replace the star character with the exact name of the generated war file.

If you want to simplify the subsequent push commands to update your app, create a manifest.yml file with the following content:

applications:
– name: your-server-name
path: target/your-war-file-name.war

Then, updating the app simply happens with the “cf push” command.

Starting with start.spring.io

Spring Boot is a new and interesting approach to building Java web applications. With it, you’ll not only create a traditional war file (at least by default), but a jar file which embeds the Web server as well. So instead of feeding Bluemix with a war file, which is then given to a Java Web server, you’ll push that jar file. The “buildpack” in Bluemix is smart enough to handle both war files and jar files.

To create and deploy a Spring Boot-powered Vaadin app to Bluemix, first create a project using start.spring.io, create a simple Vaadin UI and build the jar file. See the beginning of this introduction webinar if you need more help to get started with Spring Boot and Vaadin.

Once you have the project built, the command to deploy and update the app is almost the same as with war packaged web apps:

cf push your-server-name -p target/*.jar

When Bluemix receives the jar file, it automatically figures out it should launch this file using “java -jar your-app.jar” command, instead of creating a Liberty server and deploying the app there. Naturally, you can create a similar manifest file as with war files to simplify the process.

What next?

Now you have the basics set, the rest is just plain Java development. If you want to learn more Vaadin development, the best resource is the Vaadin tutorial. Then just use your Java skills and the huge amount of available Java libraries to implement the application of your dreams.

Sign up for Bluemix and get started with Vaadin apps. It’s free!

More How-tos Stories

Monitoring & logging for IBM Bluemix Container Service with Sematext

In this blog post we discuss how Sematext integrates with IBM Bluemix Container Service to provide monitoring and logging visibility of your containerized applications, as they run in production. In the sections below, we demonstrate how to set up a Kubernetes cluster in Bluemix and how to set up Sematext in this cluster. IBM Cloud has monitoring and logging capabilities in the platform, but we know our customers operate in a multi-cloud or hybrid cloud environment and we are very excited to partner with Sematext, enabling operational consistency across those environments. We worked with Alen Komljen, an Automation Engineer from Sematext, to create the following content and perform the technology validation.

Continue reading

99.95% availability. Balancing release velocity and reliability

Availability and reliability are rarely at the front of developers minds when delivering new applications on Bluemix. The ease and speed of creating and deploying new features is very seductive.

Continue reading

Deploying to IBM Cloud private with IBM Cloud Developer Tools CLI

IBM Cloud private is an application platform for developing and managing on-premises, containerized applications. It is an integrated environment for managing containers that includes the container orchestrator Kubernetes, a private image repository, a management console, and monitoring frameworks.

Continue reading