To create a Hello World application in WebDSL, we have to:
- Create a WebDSL project;
- Output Hello World on the root page;
- Build and deploy the application.
Create a New Project¶
Open the WebDSL editor and right-click the Package Explorer.
Select New WebDSL Project to make the project configuration show up.
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
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 # 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.
http://localhost:8080/HelloWorld/ opens the root page of your application and should output Hello world as we specified in
To stop the application server, simply press Ctrl+C in the terminal where the app is running.
In this tutorial we created a web application with WebDSL, consisting of a single page that outputs Hello world.