Project Setup
To begin this tutorial, you need a location for your project where you can manage your classes and resources. The following sections describe the different ways you can create your webforJ project for this tutorial.
Using the source code
The easiest way to follow this tutorial is to refer to its source code. You can download the entire project or clone it from GitHub:
- Download ZIP: webforj-tutorial.zip
- GitHub Repository: Clone the project directly from GitHub
git clone https://github.com/webforj/webforj-tutorial.git
Project structure
The project has five subdirectories, one for each step of the tutorial, and each contains a runnable app. Following along allows you to see how the app progresses from a basic setup to a fully functional customer management system.
webforj-tutorial
│ .gitignore
│ LICENSE
│ README.md
│
├───1-creating-a-basic-app
├───2-working-with-data
├───3-routing-and-composites
├───4-observers-and-route-parameters
└───5-validating-and-binding-data
Using startforJ
If you’d prefer to create a new project, you can use startforJ to generate a minimal starter project. See Getting Started for more detailed information about using startforJ.
- In the webforJ version dropdown, choose webforJ version 25.10 or higher.
- In the Flavor dropdown, choose webforJ + Spring Boot.
Using the command line
You can also generate a new project with the following command:
- Bash/Zsh
- PowerShell
- Command Prompt
mvn -B archetype:generate \
-DarchetypeGroupId=com.webforj \
-DarchetypeArtifactId=webforj-archetype-hello-world \
-DarchetypeVersion=LATEST \
-DgroupId=com.webforj.tutorial \
-DartifactId=customer-app \
-Dversion=1.0-SNAPSHOT \
-Dflavor=webforj-spring
mvn -B archetype:generate `
-DarchetypeGroupId="com.webforj" `
-DarchetypeArtifactId="webforj-archetype-hello-world" `
-DarchetypeVersion="LATEST" `
-DgroupId="com.webforj.tutorial" `
-DartifactId="customer-app" `
-Dversion="1.0-SNAPSHOT" `
-Dflavor="webforj-spring"
mvn -B archetype:generate ^
-DarchetypeGroupId="com.webforj" ^
-DarchetypeArtifactId="webforj-archetype-hello-world" ^
-DarchetypeVersion="LATEST" ^
-DgroupId="com.webforj.tutorial" ^
-DartifactId="customer-app" ^
-Dversion="1.0-SNAPSHOT" ^
-Dflavor="webforj-spring"
Configurations
The two mentioned ways of creating a new project use webforJ archetypes, which automatically add the needed configurations to your project, like Spring dependencies to your POM and the following properties in src/main/resources/application.properties:
spring.application.name=CustomerApplication
server.port=8080
webforj.entry = com.webforj.tutorial.Application
webforj.debug=true
Running the app
To see the app in action as you progress through the tutorial:
-
Navigate to the directory for the desired step. This should be the top-level directory for that step, containing the
pom.xml. -
Use the following Maven command to run the Spring Boot app locally:
mvn
Running the app automatically opens a new browser at http://localhost:8080.