X hits on this document





72 / 93

Page 72 of 93



Install TOMCAT web server and APACHE.

While installation assign port number 4040 to TOMCAT and 8080 to APACHE. Make sure that these ports are available i.e., no other process is using this port.


Access the above developed static web pages for books web site, using these servers by putting the web pages developed in week-1 and week-2 in the document root.

                Access  the pages by using  the urls : http://localhost:4040/rama/books.html (for tomcat)

            http://localhost:8080/books.html  (for Apache)


User Authentication :

Assume four users user1,user2,user3 and user4 having the passwords pwd1,pwd2,pwd3 and pwd4 respectively.  Write a servelet for doing the following.

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 (week1)   and authenticate with the values (user id  and passwords ) available in the cookies.

If he is a valid user(i.e., user-name and password match) you should welcome him by name(user-name) else you should display “ You are not an authenticated user “.

Use init-parameters to do this. Store the user-names and passwords in the webinf.xml and access them in the servlet  by using the getInitParameters() method.


Install a database(Mysql or Oracle).

Create a table which should contain at least the following fields: name, password, email-id, phone number(these should hold the data from the registration form).

Practice 'JDBC' connectivity.

           Write a java program/servlet/JSP  to connect to that database and extract data from the tables and display them. Experiment with various SQL queries.

Insert the details of the users who register with the web site, whenever a new user clicks the submit button in the registration page (week2).


        Write a JSP which does the following job:

        Insert the details of the 3 or 4 users who register with the web site (week9) by using registration

        form. Authenticate the user when he submits the login form using the user name and password  

        from   the database ( similar to week8 instead of  cookies).


Create tables in the database which contain the details of  items (books in our case like  Book name , Price, Quantity,  Amount )) of each category. Modify your catalogue page (week 2)in such a way that you should connect to the database and extract data from the tables and display them in the catalogue page using JDBC.


HTTP is a stateless protocol. Session is required to maintain the state.

The user may add some items to cart from the catalog page. He can check the cart page for the     

selected items. He may visit the catalogue again and select some more items. Here our interest is the selected items should be added to the old cart rather than a new cart. Multiple users can do the same thing at a time(i.e., from different systems in the LAN using the ip-address instead of localhost). This can be achieved through the use of sessions. Every user will have his own session which will be created after his successful login to the website. When the user logs out his session should get invalidated (by using the method session.invalidate() ).

Modify your catalogue and cart JSP pages to achieve the above mentioned functionality using sessions.

Document info
Document views330
Page views330
Page last viewedSun Jan 22 15:28:07 UTC 2017