发布于 2015-04-18 02:59:48 | 160 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的JSP学习教程,程序狗速度看过来!

JSP JAVA公司的WEB开发编程语言

JSP全名为Java Server Pages - java服务器页面是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。JSP技术有点类似ASP技术,它是在传统的网页HTML(标准通用标记语言的子集)文件(*.htm,*.html)中插入Java程序段(Scriptlet)和JSP标记(tag),从而形成JSP文件,后缀名为(*.jsp)。


打印a.jsp的部分页面

  1. 将影响要打印的内容放到<div id="printcontent">中
  2. 为想要打印的内容创建样式pirnt.css
  3. 在a.jsp中添加以下内容:
function printpage()
{
       OpenWindow=window.open("", "_blank");
//重写网页
OpenWindow.document.write("<head>");
OpenWindow.document.write("<TITLE>打印报表</TITLE>");
OpenWindow.document.write("<link href="<%=basePath + "css/print.css"%>" rel="stylesheet" type="text/css" />");
OpenWindow.document.write("</head>");
OpenWindow.document.write("<BODY onload=‘window.print();‘>");
OpenWindow.document.write(document.getElementById(‘printcontent‘).innerHTML );
OpenWindow.document.write("</BODY>");
OpenWindow.document.write("</HTML>");
OpenWindow.document.close();
}

最后,添加打印按钮<input onclick="printpage();"  type="button" value="打印汇总" />



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务