Java Platform, Enterprise Edition (Java EE) 8
The Java EE Tutorial
The administration interface of Duke’s Tutoring is used by the tutoring center staff to manage the data employed by the main interface: the students, the students' guardians, and the addresses. The administration interface uses many of the same components as the main interface. Additional components that are only used in the administration interface are described here.
The following topics are addressed here:
The following enterprise bean, in the
dukestutoring.ejb package of the
dukes-tutoring-war project, is used in the administration interface.
AdminBean: A stateless session bean for all the business logic used
in the administration interface. Calls security methods to allow
invocation of the business methods only by authorized users.
The following Facelets files, under
src/main/webapp/, are used in the
admin/adminTemplate.xhtml: Template for the administration interface
admin/index.xhtml: Landing page for the administration interface
login.xhtml: Login page for the security-constrained administration
loginError.xhtml: Page displayed if there are errors authenticating
the administration user
admin/address directory: Pages that allow you to create, edit, and
admin/guardian directory: Pages that allow you to create, edit, and
admin/student directory: Pages that allow you to create, edit, and
resources/components/formLogin.xhtml: Composite component for a
login form using Java EE security
WEB-INF/includes/adminNav.xhtml: XHTML fragment for the
administration interface’s navigation bar
The CDI managed beans used in the administration interface are located
dukestutoring.web package in the
StudentBean.java: A managed bean for the Facelets pages used to
create and edit students. The first and last names have Bean Validation
annotations that require the fields to be filled in. The phone numbers
have Bean Validation annotations to ensure that the submitted data is
GuardianBean.java: A managed bean for the Facelets pages used to
create guardians for and assign guardians to students. The first and
last names have Bean Validation annotations that require the fields to
be filled in. The phone numbers have Bean Validation annotations to
ensure that the submitted data is well-formed.
AddressBean.java: A managed bean for the Facelets pages used to
create addresses for students. The street, city, province, and postal
code attributes have Bean Validation annotations that require the fields
to be filled in, and the postal code attribute has an additional
annotation to ensure that the data is properly formed.
The following helper classes, found in the
dukestutoring.web.util package, are used in the
EntityConverter: A parent class to
GuardianConverter that defines a cache to store the entity classes
when converting the entities for use in JavaServer Faces user interface
components. The cache helps increase performance. The cache is stored in
the JavaServer Faces context.
StudentConverter: A JavaServer Faces converter for the
entity class. This class contains methods to convert
to strings and back again, so they can be used in the user interface
components of the application.
GuardianConverter: Similar to
StudentConverter, this class is a
converter for the
Guardian entity class.