1/25
Flashcards to review key concepts of Java Web Technology, HTTP methods, and Servlet lifecycle.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the foundation of the web?
A network of clients and servers communicating over wired and wireless networks.
What is the role of a web client?
To make a request to a web server.
What is the role of a web server?
To receive and process requests to access resources and respond to the client.
What is the difference between a website and a web application?
A website contains static web pages, while a web application features dynamic functionality on the server-side.
What is HTTP (Hypertext Transfer Protocol)?
A protocol that allows clients and servers to communicate on the web.
What is the GET method used for in HTTP?
To request data from the server.
What is the POST method used for in HTTP?
To send data to the server to create or update a resource.
In the GET method, where is the data sent?
Data is sent in the URL (hidden).
In the POST method, where is the data sent?
Data is sent in the request body.
Which HTTP method allows for sending larger amounts of data, GET or POST?
POST allows for sending larger amounts of data.
Which HTTP method is more secure, GET or POST?
POST is more secure because data is not exposed in the URL.
Which HTTP method can be bookmarked?
GET can be bookmarked.
Which HTTP method can be cached for efficiency?
GET can be cached and is more efficient.
What are Servlets?
Java technology components that create dynamic web applications, provide classes and interfaces for web development, implement the Servlet interface, and extend the capabilities of a server to handle incoming requests.
What is the basic server architecture?
A web browser (client) sends a request to the server, the server processes the request, and the server sends a response back to the web browser, often in the form of formatted HTML pages.
Give three tasks that Servlet programs perform.
Processing data sent by the client, including HTML forms; securing data; generating results by communicating with databases; and formatting data into HTML or JSP for the web browser.
What occurs during the Servlet lifecycle loading phase?
The servlet loads and instantiates objects and attributes.
What happens during the Servlet lifecycle initialization phase?
The servlet is initialized by calling the init method, indicated by a servlet container.
What happens during the Service phase of the servlet lifecycle?
The servlet calls the service method to process client requests and handles the actual request.
What happens during the destruction phase of the Servlet lifecycle?
The servlet is terminated by calling the destroy method, which runs only once at the end of its lifecycle.
When is the init() method called in the Servlet lifecycle?
Called once when the servlet is first loaded.
When is the service() method called in the Servlet lifecycle?
Called for each client request.
When is the destroy() method called in the Servlet lifecycle?
Called once when the servlet is unloaded.
What objects are created when a client sends a request to a servlet container?
ServletRequest and ServletResponse objects.
What does the ServletRequest object do?
Provides access to request information such as headers and body.
What does the ServletResponse object allow the servlet to do?
Format and send a response back to the client.