The sequence of method calls for a servlet put into service is __________, __________, and then __________.
- destroy(), init(), service()
- init(), destroy(), service()
- init(), service(), destroy()
- service(), init(), destroy()
The sequence of method calls for a servlet put into service is init(), service(), and then destroy().
What is the primary purpose of the POST method in HTTP?
- To delete data
- To request data
- To retrieve data
- To send data
The primary purpose of the POST method in HTTP is to send data to the server, typically used for submitting form data and other complex data types.
When a web application is redeployed with updated servlet configuration in web.xml, how does it affect the running servlets?
- The redeployment process has no impact on running servlets.
- The running servlets are automatically updated with the new configuration.
- The running servlets need to be restarted to apply the new configuration.
- The updated configuration only applies to newly created servlet instances.
When a web application is redeployed with updated servlet configuration, the running servlets are not automatically updated. To apply the new configuration, the running servlets need to be restarted.
Which of the following is used to specify a servlet's name in the deployment descriptor?
The element in the web.xml file is used to specify the name of a servlet. This name is then referenced in various configurations within the deployment descriptor and is essential for identifying and managing the servlet within the web application.
Which one directly interacts with the Java server pages (JSP) container?
- CSS
- HTML
- JSP
- Servlets
Servlets directly interact with the JavaServer Pages (JSP) container.
A ________ is a unique identifier generated by the server and sent to the client to maintain a session.
- Cookie
- Session ID
- Token
- URL Rewriting
The term for a unique identifier generated by the server and sent to the client to maintain a session is a Cookie.
For optimizing a web application with heavy presentation logic, which technology is more suitable?
- Both
- JSP
- None of the above
- Servlet
For optimizing a web application with heavy presentation logic, JSP (JavaServer Pages) is more suitable. JSP is specifically designed for creating dynamic web pages with a focus on presentation logic, making it easier to manage and optimize the presentation layer of a web application.
What is the primary purpose of cookies in web applications?
- To execute server-side code
- To handle database connections
- To perform client-side validation
- To store user preferences
The primary purpose of cookies in web applications is to store user preferences, enabling a personalized and persistent experience for users.
Servlets are often used for processing and sending the ______ to the client.
- Data
- HTML
- Requests
- XML
Servlets are often used for processing and sending HTML to the client.
How are servlet initialization parameters defined in the web.xml file?
Servlet initialization parameters are defined using the tag in the web.xml file.