This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Servlets are written according to the Servlet specification. This specification outlines what a Servlet can do, how a Servlet should behave, and how programmers can write code to develop servlets.
Programmers write Servlets according to the Servlet API, with an expectation of how a Servlet will behave at deployment time. When a Servlet is deployed to an applicaiton Server, like WebSphere or WebLogic, the vendor ensures that the deployed servlet behaves as a developer would expect it.
Here's a little link that describes Servlets and the J2EE server at runtime: