Skip to content

Hello World

To create a Hello World application in WebDSL, we have to:

  1. Create a WebDSL project;
  2. Output Hello World on the root page;
  3. Build and deploy the application.

Create a New Project

Package Explorer

Open the WebDSL editor and right-click the Package Explorer.

Select New WebDSL Project to make the project configuration show up.

Project Configuration

Enter project name: HelloWorld and press Finish.

Output Hello World on the Root Page

The generated project contains lots of files but we only need the main application file for this tutorial. Open HelloWorld.app in the root directory of the new project. It should look as follows:

1
2
3
application HelloWorld

  page root(){ "Hello world" }

Build and Deploy the Application

To see the resulting web application in the browser, we have to compile and deploy the WebDSL code.

Navigate to the project directory in the terminal (e.g. ~/eclipse-workspace/HelloWorld/). To compile and run the application in one command, execute webdsl run:

$ webdsl run
# This should start a local web server and generate the following output:
# ...
# [ Main | info ] stage 1: parsing HelloWorld.app         [ 0.78s ]
# ...
# [ Main | info ] stage 11: writing files                 [ 0.04s ]
# ...
# Now compiling generated Java code
# ...
# Some file copying
# ...
# Some SQL DROP/CREATE table statements
# ...
# Some Tomcat commands
# ...
# [XX <Month> XX:XX:XX HelloWorld] Tomcat web server started, your web application is available at http://localhost:8080/HelloWorld. Press ctrl+c to stop the web server.

Hello World in Browser

Browsing to http://localhost:8080/HelloWorld/ opens the root page of your application and should output Hello world as we specified in HelloWorld.app.

To stop the application server, simply press Ctrl+C in the terminal where the app is running.

Summary

In this tutorial we created a web application with WebDSL, consisting of a single page that outputs Hello world.