tut-install/examples/case-studies
Java Platform, Enterprise Edition (Java EE) 8 The Java EE Tutorial |
Previous | Next | Contents |
This section describes how to build, package, deploy, and run the Duke’s Tutoring application.
The following topics are addressed here:
You can use either NetBeans IDE or Maven to build, package, deploy, and run Duke’s Tutoring.
The following topics are addressed here:
Before You Begin
You must have already configured GlassFish Server as a Java EE server in NetBeans IDE, as described in To Add GlassFish Server as a Server Using NetBeans IDE.
Make sure that GlassFish Server has been started (see Starting and Stopping GlassFish Server).
If the database server is not already running, start it as described in Starting and Stopping Apache Derby.
From the File menu, choose Open Project.
In the Open Project dialog box, navigate to:
tut-install/examples/case-studies
Select the dukes-tutoring
folder.
Select the Open Required Projects check box and click Open Project.
Note: The first time you open Duke’s Tutoring in NetBeans, you will see error glyphs in the Projects tab. This is expected, as the metamodel files used by the enterprise beans for Criteria API queries have not yet been generated. |
In the Projects tab, right-click the dukes-tutoring
project and
select Build.
This command creates a JDBC security realm named tutoringRealm, builds
and packages the dukes-tutoring-common
and dukes-tutoring-war
projects, and deploys dukes-tutoring-war
to GlassFish Server, starting
Derby and GlassFish Server if they have not already been
started.
Make sure that GlassFish Server has started (see Starting and Stopping GlassFish Server).
If the database server is not already running, start it as described in Starting and Stopping Apache Derby.
In a terminal window, go to:
tut-install/examples/case-studies/dukes-tutoring/
Enter the following command:
mvn install
This command creates a JDBC security realm named tutoringRealm, builds
and packages the dukes-tutoring-common
and dukes-tutoring-war
projects, and deploys dukes-tutoring-war
to GlassFish Server.
Once Duke’s Tutoring is running on GlassFish Server, use the main interface to experiment with checking students in and out or sending them to the park.
To Use the Main Interface of Duke’s Tutoring
In a web browser, open the main interface at the following URL:
http://localhost:8080/dukes-tutoring-war/
Use the main interface to check students in and out, and to log when the students go to the park.
To Use the Administration Interface of Duke’s Tutoring
Follow these instructions to log in to the administration interface of Duke’s Tutoring and add new students, guardians, and addresses.
From the main interface, open the administration interface by clicking Administration main page in the left menu.
This redirects you to the login page at the following URL:
http://localhost:8080/dukes-tutoring-war/admin/index.xhtml
On the login page, enter admin@example.com
in the User name field,
and enter javaee
in the Password field.
Use the administration interface to add or modify students, add guardians, or add addresses.
To add a new student, click Create new student in the left menu, fill in the fields (two are required) in the form that opens, and click Submit. The Email, Home phone, and Mobile phone fields have formatting requirements enforced by HTML5 pass-through or by Bean Validation constraints.
To modify a student, click Edit next to the student’s name, modify the fields in the form that opens, and click Submit. To edit another student, choose the student from the drop-down menu at the top of the page and click Change student.
To remove a student, click Remove next to the student’s name, then click Confirm in the page that appears. This action removes the student from the tutoring session but does not remove the student from the database. To add the student to the tutoring session again, click Activate student in the left menu, then click Activate next to the student’s name in the page that appears.
To add a guardian for a student, click Add guardian next to the student’s name. The page that appears shows the student’s name, the available guardians, and the current guardians for the student, if any. To add an existing guardian for that student, select the guardian from the list and click Add guardian. To create a new guardian for the student, fill in the fields and click Submit. To remove a guardian from a student, select one of the student’s current guardians from the list and click Remove guardian.
To add an address for a student, click Add address next to the student’s name. In the page that appears, fill in the appropriate fields in the form that appears, and click Submit. Four fields are required.
The administration interface is not fully implemented. It is not
possible to edit a guardian or to view or edit an address, although
Facelets pages exist for these features. The application also makes no
use of the properties in the PersonDetails
entity. Feel free to modify
the application to add these features.
Previous | Next | Contents |