简体   繁体   English

如何使用使用javascript或java的打印命令来打印JSP页面中包含的表?

[英]how to print table contained in JSP page using print command using either javascript or java?

我有一个JSP页面,其中包含一个表单和一个表格。当我单击“打印”按钮时,应该只打印表格。请帮助我。

One of the way to achieve this to open another tab which will only contain that table you want to print. 实现此目的的一种方法是打开另一个选项卡,该选项卡仅包含要打印的表格。 Then on document.load of that pop-up call the JavaScript function window.print() 然后在该弹出窗口的document.load上调用JavaScript函数window.print()

This will open print window from there you can print the contents of pop-up. 这将从此处打开打印窗口,您可以打印弹出窗口的内容。

您可以使用javascript的窗口事件,只需在按下按钮时调用此事件

window.print();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM