Examples
It is easier to run our examples with Maven archetypes ready to use!
We provide a series of project examples via maven archetypes to help you accelerate your own project. Have a look on the project examples and set up them using Maven command. Please check the examples below:
Basic example
The basic example provides a web application to submit a form via Ajax request using validate, alert, input, button, icon and general components, so it can speed up your learning curve with major components and the framework.
Go to any folder you want the project to be created and enter the following command:
mvn archetype:generate -DarchetypeGroupId=com.jsmartframework -DarchetypeArtifactId=jsmart-basic-archetype -DarchetypeVersion=1.0.0 -DarchetypeCatalog=http://www.jsmartframework.com
You will be prompted to enter the ${groupId}, ${artifactId}, ${version} and ${package} for your project.
Afterwards you can access your project named via previously input ${artifactId} and start the web application using embedded Jetty 9. Check the following commands:
cd <you_artifact_id>
mvn compile jetty:run
This will start the web container with the web application. To access it, go to browser and enter the URL http://localhost:8080.
Authentication example
The authentication and authorization example provides a web application with login and home pages to control authorized access to pages besides the login, logout and access roles for each page. This example speed you up on how to work with the framework to easily provide authentication and authorization control for your web application.
Go to any folder you want the project to be created and enter the following command:
mvn archetype:generate -DarchetypeGroupId=com.jsmartframework -DarchetypeArtifactId=jsmart-aa-archetype -DarchetypeVersion=1.0.0 -DarchetypeCatalog=http://www.jsmartframework.com
You will be prompted to enter the ${groupId}, ${artifactId}, ${version} and ${package} for your project.
Afterwards you can access your project named via previously input ${artifactId} and start the web application using embedded Jetty 9. Check the following commands:
cd <you_artifact_id>
mvn compile jetty:run
This will start the web container with the web application. To access it, go to browser and enter the URL http://localhost:8080.
File handling example
The file example provides a web application with upload and download capabilities besides the use of some complex components such as list component that uses dynamic scroll behavior. This example speed you up on how to work with complex components and introduce you utility classes for handling customized response.
Go to any folder you want the project to be created and enter the following command:
mvn archetype:generate -DarchetypeGroupId=com.jsmartframework -DarchetypeArtifactId=jsmart-file-archetype -DarchetypeVersion=1.0.0 -DarchetypeCatalog=http://www.jsmartframework.com
You will be prompted to enter the ${groupId}, ${artifactId}, ${version} and ${package} for your project.
Afterwards you can access your project named via previously input ${artifactId} and start the web application using embedded Jetty 9. Check the following commands:
cd <you_artifact_id>
mvn compile jetty:run
This will start the web container with the web application. To access it, go to browser and enter the URL http://localhost:8080.
Rest example
This example provide a web application that exposes REST interface via RequestPath annotation from the JSmart framework. It also introduce you on how to work with rest component and other utility classes to provide customized responses.
Go to any folder you want the project to be created and enter the following command:
mvn archetype:generate -DarchetypeGroupId=com.jsmartframework -DarchetypeArtifactId=jsmart-rest-archetype -DarchetypeVersion=1.0.0 -DarchetypeCatalog=http://www.jsmartframework.com
You will be prompted to enter the ${groupId}, ${artifactId}, ${version} and ${package} for your project.
Afterwards you can access your project named via previously input ${artifactId} and start the web application using embedded Jetty 9. Check the following commands:
cd <you_artifact_id>
mvn compile jetty:run
This will start the web container with the web application. To access it, go to browser and enter the URL http://localhost:8080.
Event stream example
The async example introduce you the capability to keep alive asynchronous context between server and client in which you are able to push any event to client side including event-stream, as known as Server-Sent Events.
Go to any folder you want the project to be created and enter the following command:
mvn archetype:generate -DarchetypeGroupId=com.jsmartframework -DarchetypeArtifactId=jsmart-async-archetype -DarchetypeVersion=1.0.0 -DarchetypeCatalog=http://www.jsmartframework.com
You will be prompted to enter the ${groupId}, ${artifactId}, ${version} and ${package} for your project.
Afterwards you can access your project named via previously input ${artifactId} and start the web application using embedded Jetty 9. Check the following commands:
cd <you_artifact_id>
mvn compile jetty:run
This will start the web container with the web application. To access it, go to browser and enter the URL http://localhost:8080.
Dynamic scroll example
Dynamic scroll application is a web application that shows how to work with lists and tables on server via adapter classes and directly on client side through functional JavaScript library available for dealing with complex components.
Go to any folder you want the project to be created and enter the following command:
mvn archetype:generate -DarchetypeGroupId=com.jsmartframework -DarchetypeArtifactId=jsmart-scroll-archetype -DarchetypeVersion=1.0.0 -DarchetypeCatalog=http://www.jsmartframework.com
You will be prompted to enter the ${groupId}, ${artifactId}, ${version} and ${package} for your project.
Afterwards you can access your project named via previously input ${artifactId} and start the web application using embedded Jetty 9. Check the following commands:
cd <you_artifact_id>
mvn compile jetty:run
This will start the web container with the web application. To access it, go to browser and enter the URL http://localhost:8080.
Dynamic path example
Dynamic path application is a web application responsible to manage dynamic resource path so you can have unique access per path created by WebBean. This application also introduce you some useful capabilities for utility classes to handle request and response and also async events handling.
Go to any folder you want the project to be created and enter the following command:
mvn archetype:generate -DarchetypeGroupId=com.jsmartframework -DarchetypeArtifactId=jsmart-path-archetype -DarchetypeVersion=1.0.0 -DarchetypeCatalog=http://www.jsmartframework.com
You will be prompted to enter the ${groupId}, ${artifactId}, ${version} and ${package} for your project.
Afterwards you can access your project named via previously input ${artifactId} and start the web application using embedded Jetty 9. Check the following commands:
cd <you_artifact_id>
mvn compile jetty:run
This will start the web container with the web application. To access it, go to browser and enter the URL http://localhost:8080.