![]() |
In this lesson, the following has been discussed |
![]() |
Servlets are Java technology's answer to Common Gateway Interface (CGI) programming. |
![]() |
Java servlets are more efficient, easier to use, more powerful, more portable, safer, and cheaper than | |
| traditional CGI and many alternative CGI-like technologies. |
![]() |
Web container (also known as a Servlet container) is the component of a web server that is responsible for | |
| managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL | ||
| requester has the correct access rights. |
![]() |
Other functions of web container are Communications support, Lifecycle Management, Multithreading | |
| Support, Declarative Security and JSP Support. |
![]() |
Deployment Descriptor (DD) is simple XML document that conform to the XML standard, it is used to | |
| configure the web application. |
![]() |
The service() method is the main method to perform the actual task. The servlet container calls the service() | |
| method to handle requests coming from the client and to write the formatted response back to the client. |
![]() |
DO NOT override the service() method, instead, override doGet() or doPost() methods. |
![]() |
GET Asks to get the thing (resource / file) at the requested URL. |
![]() |
POST Asks the server to accept the body info attached to the request, and give it to the thing at the | |
| requested URL It's like a fat GET... a GET with extra info sent with the request. |
![]() |
POST has a body, GET hasn't. |
![]() |
POST is secured. |
![]() |
GET can be bookmarked, POST cannot. |
![]() |
GET is idempotent, POST isn't. |
![]() |
The servlet lifecycle is simple; there's only one main state-initialized. If the servlet isn't initialized, then | |
| it's either being initialized, being destroyed, or it simply does not exist. |
![]() |
Multiple concurrent requests result in multiple threads not multiple instances. |