Cse300 Advanced Web Final Exam November 2022 Qp
Cse300 Advanced Web Final Exam November 2022 Qp
Final Examination
Instructions to candidates
a) State and briefly discuss any two differences between the following with respect to
Server Side Scripting i.e. Java Server pages or Servlets (support your answer with code
fragments for each listed technology):
i. HttpServletResponse sendRedirect and RequestDispatcher forward method [6]
b) Outline the process of installing JAR files required for the JSP Tag Library (JSTL) and state
the directory path they reside in. [4]
c) Name and describe the role of five (5) standard Apache Tomcat Web directories. In
addition to this give an example of files it may contain. [5]
[Total 25 Marks]
1
Question 2
b. With the aid of a diagram explain connection pooling and why it is better than single
database connection [8]
c. Outline the steps for setting up connection pooling in Jakarta EE/Java EE application
using Tomcat as a container.
[3]
d. What is JDBC API and what is it used for in a Jakarta/Java EE application [5]
f.
[Total 25 Marks]
2
Question 3
a) Given the above information, state five(5) differences between GET and POST methods.
[5]
b) HTTP Servlet request and response methods are used to set the type of content. The
object of HttpServletRequest interface is used to handle the request and
HttpServletResponse interface is used to provide the response. The
HttpServletRequest provides methods for accessing parameters of a request. The type of
the request determines where the parameters are coming from. In most
implementations, a GET request takes the parameters from the query string, while a
POST request takes the parameters from the posted arguments. So, the
HttpServletResponse interface defines an object to assist a servlet in sending a response
to the client. The servlet container creates a ServletResponse object and passes it as an
argument to the servlet's service method.
Given the above information, with an aid of a diagram describe the servlet life cycle. [10]
c) With the aid of code snippet, describe two ways in which you can map or register a
servlet [6]
[Total 25 marks]
3
Question 4
You are part of the development team for a Student Management System, and you have
been given a task to write a module or method that will update the student record in a
Helper Class (Database Access Object). The student details include FirstName, LastName,
EmailAdrress and StudentId. Your solution must include declaration of the Database objects.
a) Write a code snippet for the Update method of the student records based on the above
scenario including the following:
b) Explain the reason why the close () method is called within the finally block when
dealing with the database connection pool. [2]
c) Explain the reason why database connection pools are used [2]
d) State a JDBC object that is used to retrieve data from the database [1]
[Total 25 marks]
4
Question 5
a) Study this diagram below and use it to explain how dynamic pages work. (Give 5 points for full
marks) [5]
d) For this question, your answer should address 1) Client-Side Tier, 2) Server-Side Tier and
3) Java Beans
i. Briefly discuss how the Model View Controller Model 1 architecture is used in a java
dynamic web application with small processing requirements. [6]
ii. Further Illustrate your answer above with a diagram [4]
iii. and relevant code snippets [2]
b) Describe how URL Rewriting and Hidden form fields are used to support the stateless
HTTP protocol (4 points). In addition to this, state any disadvantage that may arise from
using each one of them. [8]
[Total 25 Marks]
END OF PAPER