最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - print page by jsp like normal printing - Stack Overflow

programmeradmin1浏览0评论

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
Add a ment  | 

2 Answers 2

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>
发布评论

评论列表(0)

  1. 暂无评论