A servlet is a Java programming language class used to extend the capabilities of a server. Although servlets can respond to any types of requests, they are commonly used to extend the applications hosted by web servers. They are the Java counterpart to non-Java dynamic Web content technologies such as PHP and ASP.NET. The servlet gets deployed in a Servlet Container such as Tomcat, just like ASP.NET page gets deployed in IIS or PHP page gets deployed in Apache HTTPD.
Having said that there is no special coding required to upload a file as far as client side is concerned. On the server side you must write a servlet implementation which will accept the uploaded file and store it somewhere may be on the local storage of server. Here [^
] is a very good tutorial.