On a html page there are two options of viewing data. One is display and the other is print. when the user clicks on the display button, data can be viewed on the screen. However when the user clicks the print button the data should not be displayed on the screen instead it should go directly to the printer. I'm using a servlet for displaying data. For the print function , I'm using a class which implements the printable interface.The data to be printed is passed as a string. The problem is I cannot create an object of this class in a servlet. The exceptions thrown are ClassDefNotFound,DuplicationError,ClassFormat Error etc. So how do I go about it.