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>
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>
Share
Improve this question
edited Jul 27, 2012 at 6:25
arjuncc
3,2975 gold badges44 silver badges78 bronze badges
asked Feb 22, 2012 at 11:53
TomTom
7717 gold badges22 silver badges42 bronze badges
2 Answers
Reset to default 5<input type="submit" value="print" onClick="window.print()"/>
Please, try this one:
<p class="print-align-right">
<a href="#" onclick="javascript:window.print();" >Print this page</a>
</p>