/Users/lyon/j4p/src/net/server/servlets/UserAuthorizationPage.java

1    package net.server.servlets; 
2     
3     
4    /** 
5     * The UserAuthorizationPage class is a type of HTML page 
6     * which is used to prompt a user for their user id and 
7     * password. This information is returned to the class 
8     * FormProcessorServlet for validation. 
9     * 
10    * @author Robert Lysik 
11    * @version 1.00 
12    */ 
13   class UserAuthorizationPage extends net.server.servlets.HtmlPage { 
14    
15       /** 
16        * This is the default constructor for the 
17        * UserAuthorizationPage class. The parent constructor 
18        * is caller with the page title, 'User Authorization Page'. 
19        * A form is added to the page which is used to prompt 
20        * the user to enter their user id and password. The form 
21        * data is passed to the FormProcessorServlet class when 
22        * the user clicks 'Enter'. 
23        */ 
24       UserAuthorizationPage() { 
25           super("User Authorization Page"); 
26    
27           addText("Enter your user id and password, then click 'Enter'"); 
28           addBreak(); 
29           startForm("post", 
30                   "http://localhost:8080/examples/servlet/FormProcessorServlet"); 
31           addBreak(); 
32           addText("User id: "); 
33           addInput("text", "txtUserId", "", "10"); 
34           addBreak(); 
35           // The password input type does writes the character '*' 
36           // for each character typed by the user, but retains the 
37           // actual string entered. 
38           addText("Password: "); 
39           addInput("password", "txtPassword", "", "10"); 
40           addBreak(); 
41           addSubmit("Enter"); 
42           // The 'status' variable is used to determine which state 
43           // is currently active when processing occurs in the FormProcessorServlet. 
44           addHidden("status", "authorizing"); 
45           endForm(); 
46       } 
47   }