How can I use a servlet to print a file on a printer attached to the server?
This depends on how your printers are attached to your computer. I can think of two basic ways you can print to a printer attached to the server.
One approach is to create a java.awt.Frame, and then use java.awt.Toolkit's getPrintJob method to print that Frame to the printer. This will return a java.awt.PrintJob object if it works.