You are on page 1of 3

Final Examination Date: 08/06/2011 Duration: 120 minutes SUBJECT: Web Application Development Dean of School of Computer Science

and Engineering Signature:

Lecturer: Vo Duy Khoi Signature:

Full name: Dr. Nguyen Duc Cuong INSTRUCTIONS:

Full name: Vo Duy Khoi

Notes: This is an open test. Notebook is allowed to use. The total point of the final-exam is 100.

Scenario explanation This exam aims to build a website based on MVC model. The model contains: - One controller named: FinalController - Three views named and 1 menu page: index.jsp (contains Main Menu); Login.jsp; viewProfile.jsp; and Logout.jsp Main flow of site actions is as follows: Login Yes Process Login

Main menu

Login? No View Profile? No Logout? Yes FinalController Yes No Already Login? Yes View Profile

Back to Main menu

Question 1: (20 points) Write a bean named ProfileBean with properties as details: - Username: can be get/set.

- Password: can be set/get - Year Of Birth: can be get only - Country: can be get only - Message: can be get only. If username/password are john/123456 then message will be You successfully login. Otherwise, message will be Invalid login

Question 2: (40 points) Controller implementation Write code to implement the controller to control the flow as figure above. In the controller, process to check if user is logged in or not is done by detecting the present of a profile bean. If profile bean is present in session object, user already logged in. Otherwise user did not log in. In case user did not log in, create a new profile bean with submitted information. Assume action strings are Login, Submit Login, View Profile, and Logout corresponding to login action, login submission action, view profile action and logout action respectively.

Question 3: (20 points) Views implementation - Index.jsp (main menu): display hyperlink to each view via controller - Login.jsp: display login page and submit data to controller with Login action string - viewProfile.jsp: display profile bean information retrieved from session object (if user logged in) - Logout.jsp: destroy session bean and display a message: You successfully logged out. The interfaces of the views can be referred to following figures:

Main menu

Login

View profile

Question 4: (20 points) Write code to change logout page to simple AJAX action using function document.write() to display whole page sent from controller. END

You might also like