8.1.6.5.2 The Detailed Code for the Java Bean Class
The code for the Java bean class LogInBean.java is shown in Figure 8.33. The functionality of each part of the code is illustrated in the following.
A. Two properties, userName and passWord, are defined first, and these two properties must be identical to the id attributes defined in the inputText and inputSecret tags in the JSF page LogIn.jsp we discussed previously.
B. The associated getter methods for these two properties are declared and defined in steps B and D, respectively.
C. The associated setter methods for these two properties are defined in steps C and E.
F. The action method attribute of the LogIn commandButton tag in the executed when the LogIn button is clicked by the user.
G. The data access method LogInQuery() is defined, and this method is used to perform the database-related query and business logic and return a outcome string to the JSF page. The JSF page will use its handler to search the returned outcome string to determine the next page to navigate.LogInAction()isdefined,andthismethodisboundtotheactionLogIn.jsppage.Thismethodwillbe So far, we have provided a very detailed introduction to and review of the development his-tory of Java Web applications using different components, such as Java Servlet and HTML pages, JavaServer Pages and help classes and JavaServer Pages and Java beans, as well as JavaServer Faces and Java bean techniques. In the following sections, we will provide more detailed discussion for each component and technique. Following these discussions, we will begin to build and develop real Java Web application projects to perform data actions against our sample database.
