Servlets Flashcards

1
Q

Explain the purpose of the urlPatterns annotation as found in servlets, for
example:
@WebServlet (name = “dataServlet”, urlPatterns = {“/dataServlet”})

A

The name variable can be referenced as the ACTION from HTML forms easily to send data to the servlet for example

urlPatterns is a mapping of the requested URL to the servlet controller.

When a client navigates to a certain part of a website it will be pattern matched to this servlet.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain the difference between request scope, session scope and application
scope in JEE applications.

A

Application scope lasts from the point the web app is first started on the server until it is shut down or restarted.

Request scope lasts from when a request is first made to a servlet and lasts until it delivers a response.

Session scope lasts from when a client i.e. web browser is first opened unitl it is closed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly