[ Team LiB ] 5.3 The Left-Hand Navigation
[ Team LiB ] 5.3 The Left-Hand Navigation The left side of the page has thus far contained only the daily quiz, which was developed in Listing 3.13, and a link to the customization page. This will now be enhanced by the addition of a login box from which the user can log in. This will also be a simple form, but in the interest of encapsulation, it will be placed in its own file and included with a jsp:include. Listing 5.2 shows the new login form. Listing 5.2 The login form
This file contains no beans, scripts, or special tags, which should come as no surprise. There have already been many examples of forms that provide values to beans, and in all these cases, the forms themselves need not know anything about the beans, as all the action happens on the receiving page, where the form values are loaded into a bean with the jsp:setProperty tag. The only requirement for this to work is that the bean’s properties must be called username and password. Because these names were chosen in the data-modeling phase, both the author of this form and the author of the UserInfoBean will know to use those names. The implementation of the UserInfoBean used in this chapter knows about one user whose username and password are both “test”, so those are the values to enter into the login form when exploring the examples on the CD-ROM. The other necessary element of the left-hand navigation is the list of sections available in the current edition. The designer for the site would like an asterisk next to the current section so that the user will always know where in the site he or she currently is. The section list will also be placed in a separate file for easy manipulation; this file is shown in Listing 5.3. Listing 5.3 The list of sections <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
Hint: If you are looking for very good and affordable webspace to host and run your tomcat hosting application check Virtualwebstudio tomcat web hosting provider