JSP Tag Libraries

Скачать в pdf «JSP Tag Libraries»

The user first needs to provide standard information such as name, address, email address, desired username, and the like; the site accepts these parameters, comes up with a password, and sends it by email. Since the user may also forget his password or username, the registration application also provides a reminder service whereby the user can provide his email address and the site will again send those to him. It is obvious that the user can access one of two HTML forms:

■    Registration form, in which the user provides basic information, thus registering with the service.

■    Reminder form, wherein the user can enter his email address so that the site will re-send him his user name and password when necessary.

The system will send one type of email for new accounts and a different type for password reminders, yet these emails share the sender ID and the mail server.

NOTE In a real-world site, all information should be kept inside a database. Our sample, however, is not yet centered on one, as database access is not our primary concern here and it may move the focus away from email tag usage. Instead, we are using Beans that mimic possible database results by returning random results. This logic is implemented in the class book.-beans.Registrator.

The HTML-based registration form

The user registration form is presented in
figure 7.2. After the users provide the required information and submit it to the site, the site will then execute the registration JSP file.

The registration JSP file

The registration JSP file is presented in
listing 7.9.

Скачать в pdf «JSP Tag Libraries»