Professional Documents
Culture Documents
Tutorial Week 4
Tutorial Week 4
Tutorial Week 4
Our readings (lecture notes and video lecture) this week discuss the fundamental of web
technology and introduction to Servlet. Write the answers for all questions in the table according
to your understanding. PLEASE USE YOUR OWN WORDS. DO NOT COPY FROM THE
WEB.
Questions Answers
1. Explain how servlets works based on below figure. The HTTP Client sends a
request message to a HTTP
Server through the HTTP
over TCP/IP.
MMR2020@FSKM
Lecture Assignment
Can you run a servlet by simply typing the servlet class file No,
name?
4. Let say you develop a servlet by defining a class name No, you need to use the
ListLibraryServlet that extends HttpServlet class. servlet.
No, it will show error
MMR2020@FSKM
Method doGet
- Responds to GET requests
- Default action:
BAD_REQUEST error (file
not found)
- Override for custom GET
processing
- Arguments represent client
request and server response
5. Describe the life cycle of a servlet. - Servlet class is
loaded
- Servlet instances is
created
MMR2020@FSKM
Lecture Assignment
7. Explain the difference between HTTP request and HTTP - HTTP Request
response. defines a more
general interface to
provide information
Lecture Assignment
MMR2020@FSKM
for all kinds of clients.
- HTTP Response
defines a more
general interface for
sending output to the
MMR2020@FSKM
Lecture Assignment
client.
8. Find an example of code that use HTTP request for Servlet. public class HTTPGetServlet
Explain. extends HttpServlet {
MMR2020@FSKM