The tasks-jsf
quickstart demonstrates how to use JPA persistence with JSF as the view layer.
The tasks-jsf
quickstart demonstrates how to use JPA persistence with JSF as view layer in an application deployed to WildFly Application Server. It provides a JSF front end for the tasks quickstart.
The theme of this application is simple Task management with simple login. The project contains two entities - a user
and a task
.
This sample includes a persistence unit and some sample persistence code to introduce you to database access in enterprise Java. Persistence code is covered by tests to help you write business logic without the need to use any view layer.
JSF is used to present the user two views.
-
authentication form: This provides the simple login
-
task view: This view contains the task list, a task detail, and a task addition form. The task view uses AJAX.
- H2 Database
-
This quickstart uses the H2 database included with WildFly Application Server 31. It is a lightweight, relational example datasource that is used for examples only. It is not robust or scalable, is not supported, and should NOT be used in a production environment.
- Datasource Configuration File
-
This quickstart uses a
*-ds.xml
datasource configuration file for convenience and ease of database configuration. These files are deprecated in WildFly and should not be used in a production environment. Instead, you should configure the datasource using the Management CLI or Management Console. Datasource configuration is documented in the Configuration Guide. - Performance and Scalability
-
A Jakarta EE container is designed with robustness in mind, so you should carefully analyze the scalabiltiy, concurrency, and performance needs of your application before taking advantage of these techniques in your own applications.
The application this project produces is designed to be run on WildFly Application Server 31 or later.
All you need to build this project is Java 11.0 (Java SDK 11) or later and Maven 3.6.0 or later. See Configure Maven to Build and Deploy the Quickstarts to make sure you are configured correctly for testing the quickstarts.
In the following instructions, replace WILDFLY_HOME
with the actual path to your WildFly installation. The installation path is described in detail here: Use of WILDFLY_HOME and JBOSS_HOME Variables.
When you see the replaceable variable QUICKSTART_HOME, replace it with the path to the root directory of all of the quickstarts.
-
Open a terminal and navigate to the root of the WildFly directory.
-
Start the WildFly server with the default profile by typing the following command.
$ WILDFLY_HOME/bin/standalone.sh
NoteFor Windows, use the WILDFLY_HOME\bin\standalone.bat
script.
-
Make sure you start the WildFly server as described above.
-
Open a terminal and navigate to the root directory of this quickstart.
-
Type the following command to build the quickstart.
$ mvn clean package
-
Type the following command to deploy the quickstart.
$ mvn wildfly:deploy
This deploys the tasks-jsf/target/tasks-jsf.war
to the running instance of the server.
You should see a message in the server log indicating that the archive deployed successfully.
The application will be running at the following URL http://localhost:8080/tasks-jsf/.
You will see the following warnings in the server log. You can ignore these warnings.
WFLYJCA0091: -ds.xml file deployments are deprecated. Support may be removed in a future version.
HHH000431: Unable to determine H2 database version, certain features may not work
When you are finished testing the quickstart, follow these steps to undeploy the archive.
-
Make sure you start the WildFly server as described above.
-
Open a terminal and navigate to the root directory of this quickstart.
-
Type this command to undeploy the archive:
$ mvn wildfly:undeploy
This quickstart provides Arquillian tests. By default, these tests are configured to be skipped since Arquillian tests require the use of a container.
Note
|
The Arquillian tests deploy the application, so make sure you undeploy the quickstart before you begin. |
Follow these steps to run the tests.
-
Start the WildFly server as described above.
-
Open a terminal and navigate to the root directory of this quickstart.
-
Type the following command to run the
verify
goal with thearq-remote
profile activated.$ mvn clean verify -Parq-remote
Note
|
You can also let Arquillian manage the WildFly server by using the |
You can also start the server and deploy the quickstarts or run the Arquillian tests in Red Hat CodeReady Studio or from Eclipse using JBoss tools. For general information about how to import a quickstart, add a WildFly server, and build and deploy a quickstart, see Use Red Hat CodeReady Studio or Eclipse to Run the Quickstarts.