[ Team LiB ] 5.4 The Login Page

[ Team LiB ] 5.4 The Login Page Now that a form has been provided so users can log themselves in on the system, there needs to be a page that will perform the necessary actions. The page that does this is shown in Listing 5.5. Listing 5.5 The login handler <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> You have sucessfully logged into Java News Today!

Click here to proceed to your custom edition. We’re sorry, we were unable to log you in. Perhaps you mistyped your username or password; use the form on the left to try again. This page begins with the usual things, including loading the UserInfoBean. The bean’s properties are then set: the username and password from the login form in Listing 5.2. Part of the UserInfoBean’s job as the model of users is to provide a mechanism that logs a user in on the system, given the username and password. This mechanism is triggered by setting the login property of the bean, which will cause the bean to check these values against a list of all users in the system; if a match is found, the isLoggedIn property will be set to true. This setting of properties has to be done before the page top is included. If it were done afterward, the user’s isLoggedIn property would still be false during processing of the header and navigation, and consequently the name would not be shown and the login form would. The rest of the page is pretty anticlimactic: another c:choose tag used to determine whether the login succeeded and to display an appropriate message in either case. [ Team LiB ] Page 97
Note: If you are looking for inexpensive but high quality provider to host and run your jsp application check Astra jsp hosting services

Comments are closed.