0% found this document useful (0 votes)
7 views

Cse300 Advanced Web Final Exam November 2022 Qp

Uploaded by

mlethabo17
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Cse300 Advanced Web Final Exam November 2022 Qp

Uploaded by

mlethabo17
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

School of Computing and information Systems

PROGRAMME: BSC. COMPUTER SYSTEMS ENGINEERING

CSE303-Advanced Web Development Year 3


Semester 1

Final Examination

Date: 25/11/2022 Time: 1400Hrs

Total Marks: 100 Duration: 3hrs

Instructions to candidates

1. The question paper has five (5) Questions


2. Candidates must attempt any (4) Questions.
3. Candidates attempting to gain unfair advantage or colluding in any way whatsoever
are liable to be disqualified.
4. Do NOT open the question paper until you are told to do so.
5. Candidates are not allowed to bring any material that may be used to copy, collude,
or plagiarize the examinations
6. Students are not allowed to write on the question paper.

This question paper consists of thirteen (10) printed pages


including the cover page
Question 1

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]

ii. include directive and include action using JSP [6]

iii. Servlet and JSP [4]

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

a. Database connection in web applications is a necessity and web application developers


tend to think that they only need a single database connection when setting up a tomcat
database connection. Explain the best practices of setting up a database connection in a
J2EE web application using Tomcat OR Glassfish, or any servlet engine? [3]

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]

e. Explain the following code snippet [6]

f.

[Total 25 Marks]

2
Question 3

HTTP is a transfer protocol which is established to allow communication between a client


and a server. This protocol works as a request-response way of communication between a
client and a server. For instance, a client using the browser sends an HTTP request to the
server, then the server returns a response to the client as a generated HTML file. This
process of request-response protocol utilises two (2) HTTP methods: GET and POST
methods.

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]

d) What is difference between ServletConfig and ServletContext? [4]

[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:

i. Method name that throws an Exception [2]


ii. Declaration of the two (2) Database objects [2]
iii. Get the database connection [2]
iv. Create a SQL update statement for updating the student records
[2]
v. Prepare the update statement for the SQL statement [2]
vi. Set parameters to get the student details using the accessor methods
[8]
vii. Execute the SQL statement [2]

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

You might also like