Hey, thanks for the link.
.. and yeah, its on the server. actually I created the form in html and I have given a button "Print" to print the form. Whenever the user opens this form, he/she should be able to print it on clicking the print button. I can do this in javascript but I don't know how to do it in java..