Tom
Tom

Reputation: 771

print page by jsp like normal printing

Ok finally i need to ask my question here as i did not find any solution. My question is how can i print a jsp page when i click on print button(on that page)? For example i have a jsp page and i have written something then when i click on print button(like submit button) then that jsp page will be sent to print and when i will click print on that print screen then page will be printed. Any help please?

<html>
<head>
<title>A jsp page</title>
</head>
<body>

//have written something and want to print this by java code

<input type="submit" value="print"/>// click here to print
</body>
</html>

Upvotes: 0

Views: 13736

Answers (2)

raja777m
raja777m

Reputation: 411

Please, try this one:

<p class="print-align-right">
     <a href="#" onclick="javascript:window.print();" >Print this page</a>
</p>

Upvotes: 0

Ravi Bhojani
Ravi Bhojani

Reputation: 1052

<input type="submit" value="print" onClick="window.print()"/> 

Upvotes: 5

Related Questions