Please enable JavaScript.
Coggle requires JavaScript to display documents.
2.0 DEVELOPING SERVLETS (Steps to Create Servlet Application in Netbeans…
2.0 DEVELOPING SERVLETS
-
-
How a Servlet Works
iii. Container creates or allocates a thread and calls Servlet's service() method and passes request.
iv. Service() method decides which servlet method, doGet() or doPost() to call.
-
-
-
vi. After service() method completed, thread dies. And the request and response objects are ready for garbage collection.
Handling Client Request
-
-
-
Since HTML is a static language which control validate client data. Hence, in real time applications client data will be accepted with the help of HTML tags by developing form and every form must call a servlet.
Mapping a Servlet
Web.xml
- To configure a servlet in the web.xml file.
Specifies web container of which java servlet should be invoked for URL given by client. It maps URL patterns to servlets. When there is a request from client, servlet container decides to which application it should forward to. Then context path of URL is matched for mapping servlets.
How is Servlet Mapping Defined ?
- Servlet should be registered with servlet container.
- Servlet-mapping has two child tag: url-patten and servlet-name.
- The WEB-INF Directory
- Web.xml
- Classes
- Lib
-
-
-
Use Forward Request