Java servlets are server-side Java programs that run within a web server and act as a middle layer between requests from web browsers and databases or applications on the server. Servlets have advantages over other server-side technologies like CGI in that they are persistent, portable, server-independent, and faster since they are compiled to bytecode. To run a servlet, you create a directory structure under Tomcat for the application, write and compile the servlet source code, create a deployment descriptor, run Tomcat, and call the servlet from a browser.