hello ,
I have a problem......
I actually have a servlet ... and this servlet actually retrieves the values from my database and displayes them in a table. All this works fine... but now ,below this table , i want to have button saying " Print this Page" , so that when i click this button, i need an hard copy of the page..... i actually do not know how to write the code for activating the printer and printing the web page content when i click this button....could anyone please give me a clue.....

Recommended Answers

All 2 Replies

it's a single line of Javascript. Any decent book or tutorial should be able to tell you what it is.

Member Avatar for Rhyan

hello ,
I have a problem......
I actually have a servlet ... and this servlet actually retrieves the values from my database and displayes them in a table. All this works fine... but now ,below this table , i want to have button saying " Print this Page" , so that when i click this button, i need an hard copy of the page..... i actually do not know how to write the code for activating the printer and printing the web page content when i click this button....could anyone please give me a clue.....

Put the following on your page:

<input type="button" value="Print this page"
onclick="window.print()" />
That is all...
Good luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.