A Java program that operates in conjunction with a Web server, and can output Hypertext Markup Language (HTML) to a browser or even communicate with Java applets. Servlets offer an alternative to using Common Gateway Interface (CGI) and server application programming interfaces (SAPIs) to communicate with Web server processes.