Week-8:
User Authentication: Assume four users user1, user2, user3 and user4 having the passwords pwd1, pwd2, pwd3 and pwd4 respectively. Write a servlet for doing the following.
A) 1. Create a Cookie and add these four user ID’s and passwords to this Cookie.
2. Read the user id and passwords entered in the Login form and authenticate with the values (user id and passwords) available in the cookies.
If he/she is a valid user (i.e., user-name and password match) you should welcome him/her by name(user-name) else you should display “You are not an authenticate User”.
B) Use init-parameters to do this.
Store the user-names and passwords in the web.xml and access them in the servlet by using the getInitParameters() method.
Download
0 formats
No download links available.
wt # 71 | Init-Param | access parameters in the servlet by using the getInitParameters() method | | NatokHD