Implement a servlet that presents a new user with a form


Problem:

Automatic Log-in

a. Implement a servlet that presents a new user with a form containing fields for entering a user name and password (the latter should use an appropriate type of input element). The form should also contain a checkbox, initially unchecked, labeled "Check to log in automatically in the future." If the user checks the box and successfully logs in (that is, the username and password are both "CSisCoolStuff"), then the user name and password should be stored in two cookies (you may assume that cookies are enabled on the client). After successfully logging in, the user should see a page that says "Logged In Successfully." An unsuccessful attempt to log in should return the user to a page with an error message followed by the original login form, with the checkbox checked if it was checked on the previous form and unchecked otherwise. On subsequent visits, the servlet should attempt to log the user in using cookie information, if available. If this fails, the user should see the original log-in form, without any error message. If it succeeds, the user should see a "Welcome Back" page. Set the cookies to expire after six months.

b. Extend the program in (a) so that if it tries to store the user name and password in cookies but fails, it will display a message on the "Logged In Successfully" page informing the user that cookies must be enabled in order to automatically log in.

Additional Information:

The question is from Computer Science and it explains about writing the program which validates a web-user by offering a checkbox with username and password. For successful login with login Id and password, the program should show a window saying successfully logged in and with wrong login Id and password, a window should show error message. This has been presented in the solution comprehensively. You can find out the program attached along with the solution.

Total Word Limit: 488 Words

Solution Preview :

Prepared by a verified Expert
HR Management: Implement a servlet that presents a new user with a form
Reference No:- TGS01109594

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)