Show TOC Start of Content Area

Process documentation Developing Servlets  Locate the document in its SAP Library structure

Purpose

This process must give Web application developers a general idea about the tasks they may perform when developing HTTP servlets. Each of the tasks is then described in detail.

Process Flow

There are several methods that you may have to override or implement when developing your own servlet. These refer to different phases of the life-cycle of the servlet:

·        Initializing the serlvet – you can override the init() method of the servlet so it can read persistent configuration data (which you specified in the <init-param>tag of the deployment descriptor), to initialize a resource that it uses, or another one-time activity for each servlet life-cycle.

·        Servicing requests – you implement the logic in the service method, or one of the doGet, doPost, doPut, doTrace, doDelete, doOptions methods. You manipulate the request object that the Web Container passes to the method, program some logic and then send the results back to the client using the response object.

·        Finalizing the servlet operations – you can override the destroy() method of the servlet to release all resources the servlet uses, or to save any persistent state before the servlet instance is destroyed.

You can also consider handling multithreading issues in your servlet code, or handling various life-cycle events by implementing event listeners. These topics are also covered in detail below.

Note

You can use the integrated SAP NetWeaver Developer Studio through the whole process of developing your servlets. It provides various features that simplify development, such as generating standard methods, import statements, and so on.

 

End of Content Area