print from jsp page

I have an excel document ,and the entire document object is available in the jsp. I need to open a popup for print on click of a button and just print the document as it is .
How to go ahead with this . Need to do this from jsp and not from the jave class.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Well, you can use the window.print function to print the current page.

<input type="button" value="Print this page"  onClick="window.print()">

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fender_21Author Commented:
I have already implemented that. I have a HSSFWorkbook object which I need to print.
Window.print() works fine in terms of opening the popup and configuring the printer etc. But,
I don't need to print the page , rather the HSSFWorkbook object I want to pass to this print command.
How can I do this ?
NO you cannot do that from the JSP other than printing what is in the current window.

What we followed was that on click of print button we used to open a new window that opened the same page minus the other stuff by checking a passed param in the JSP(isPrint) and then call window.print() on print button on that.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.