- 浏览: 529 次
-
最新评论
收藏列表
- 全部 [175]
- 默认 [46]
- jython [1]
- java泛型编程 [1]
- js正则表达式详解 [1]
- jdbc连接数据库 [1]
- 数据库连接池配置 [1]
- struts.xml [1]
- java读取xml文件 [1]
- java文件读写操作 [1]
- http://china-pub2010.iteye.com/blog/1413544 [1]
- java连接sql server数据库 [1]
- java连接sql server数据库2 [1]
- web.xml中配置404错误页面 [1]
- 自己的java读取xml文件-采用jdom技术 [1]
- 自己写的java读取xml文件-采用jdom技术-2 [1]
- 自己写的java读取xml文件-采用jdom技术-3 [1]
- js 解析xml文件实现省市级联下拉菜单 [1]
- frame框架的应用 [1]
- frame框架的应用2 [1]
- html 第六章 css + div实现整体布局 [1]
- 为div添加滚动条 博客分类: css [1]
- 布局管理 [1]
- java 连接各种数据库 [1]
- 自己的xml_dtree树形菜单的实现 [1]
- spring连接池配置详解 [1]
- spring连接池配置详解2 [1]
- spring连接池配置详解3 [1]
- hibernate数据库连接池配置 [1]
- tomcat配置数据库连接池 [1]
- tomcat配置数据库连接池2 [1]
- commons-fileupload工具的api与开发实例解析(一) [1]
- 利用 commons-fileupload 实现文件上传 [1]
- apache common fileupload api 详解 [1]
- 用java生成word文档 [1]
- java读取与写入excel文件 [1]
- java读写word文档2 [1]
- java poi word 写文档 [1]
- 实现jxl读取excel的demo实例 [1]
- 使用jacob来处理word文档—jacob的使用及下载安装 [1]
- java读取word文档-3 [1]
- js正则表达式访问网址 [1]
- 正则表达式笔记 [1]
- js正则表达式 2 [1]
- javascript与jquery 控制表格行的字体与背景色 [1]
- 给奇偶行分别设置不同的背景色 [1]
- strtus2通常情况下使用以下两种方式来访问上述三种对象,即servlet api解藕和耦合的访问方式。 [1]
- hibernate批处理 hibernatejdbc [2]
- 自己的jquery-dialog [1]
- struts2 上传文件大小设置 [2]
- struts2 上传文件类型限制 [1]
- jquery 异步提交表单并弹出提示结果信息 [1]
- 超级链接中的target关键字 [1]
- 自己的jquery 异步提交表单并弹出提示结果信息22 [1]
- struts2 ognl表达式的应用 [1]
- hibernate批处理2 [1]
- jquery easyui 操作总结 [1]
- jquery 操作总结 [1]
- jmail 简单应用 [1]
- struts2 文件下载 [1]
- 网页上的表格边框设计更多效果变化 [1]
- struts2文件下载 12 [1]
- 部件表与新物料认证表的关联关系 [1]
- js正则表达式验证数字 [1]
- 自己的hibernate批处理 [1]
- hibernate批处理pojo类 [1]
- hibernate批处理action [1]
- newmateappbilldaoimpl.java [1]
- dqdocumentdaoimpl.java [1]
- dqassemblydaoimpl.java [1]
- 文件上传action [1]
- 文件下载action [1]
- 文件下载页面 [1]
- 从word模板生成word文件 [1]
- <s:action>标签的使用 [1]
- 单元测试-junit [1]
- 单元测试-junit-dao层 [1]
- 监听器的创建 [1]
- holdpuke_1 [1]
- holdpuke_2 [1]
- holdpuke_3 [1]
- holdpuke_4 [1]
- holdpuke_5 [1]
- holdpuke_6 [1]
- holdpuke_7 [1]
- holdpuke_8 [1]
- jython-2 [1]
- jython_3 [1]
- 自定义标签和标签库函数的学习--自己的demo [1]
- 自定义标签和标签库函数的学习 [1]
- 手动编译java文件 [1]
- jquery_demo_1 [1]
- jquery批量文件上传 [1]
- 重写hashcode方法和equals方法demo [1]
- 重写hashcode方法和equals方法demo2 [1]
- 重写hashcode和equals方法2 [1]
- java web定时任务 [1]
- java异地备份 [1]
- linux上部署java web应用 [1]
- 异地备份2 [1]
- java读写文件如何避免中文乱码 [1]
- system.data.sqlclient.sqlerror: 备份集中的数据库备份与现有的 'xxx' 数据库不同 [1]
- sql server 日期操作 [1]
- 用java 程序实现二进制像十进制转化 或十进制转化为二进制 [1]
- sql server 2005 及以上版本的sql分页查询 [1]
- sql server 2005-----sql语句分页sql [1]
- sql中的日期操作 [1]
- dwr demo [1]
- 我的校验码生成技术--demo [1]
- log4j--demo [1]
- license系统功能介绍 [1]
- java枚举类型的使用--demo [1]
- 自己的文件批量压缩demo [1]
- java调用mysql存储过程的简单示例 [1]
- jfreechart报表技术的原理简述: [1]
- 多线程demo--生产者与消费者 [1]
- uploadify传参解决方法 [1]
- svn服务器的配置 [1]
- birtdemo.rptdesign文件01 [1]
- birtdemo.rptdesign文件02 [1]
- 获取birt报表引擎对象 [1]
- http://www.iteye.com/topic/611837 [1]
- 表单校验checkform [1]
- html5 canvas平移-示例 [1]
- html5拖动单个图标 [1]
- div拖动、平移 [1]
- 禁用鼠标点击事件 [1]
- 自己实现的下拉多选框 [1]
- idea中tomcat启动时报内存溢出问题处理 [1]
标题 | 标签 | 来源 | |
idea中tomcat启动时报内存溢出问题处理 | idea中tomcat启动时报内存溢出问题处理 | ||
第一步 ———————————————— https://blog.csdn.net/ForeverAnt/article/details/90209554 名词解释 java.lang.OutOfMemoryError 内存不足错误 java.lang.StackOverflowError 栈溢出错误 用Intellij IDEA开发应用时,如果编译的代码量很大,会碰到 java.lang.OutOfMemoryError: Java heap space 的报错: 通常解决方法如下 1.点击file—setting——搜索compiler 2.修改“bulid process heap size(Mbytes)” 的值 改为 2048 点击"Apply"—“OK” 第二步: 修改idea安装路径下的idea64.exe.vmoptions文件中添加两个参数: -Xms512m -Xmx2048m |
|||
centeros7配置nginx为https证书 | |||
--查找nginx whereis nginx nginx 启动 systemctl start nginx 停止 systemctl stop nginx 重启 systemctl restart nginx --查找文件 find / -name 'webapp.conf' /bin/systemctl restart nginx.service centos7 生成ssl证书,搭建https地址 https://blog.csdn.net/qq_22385935/article/details/91990876 |
|||
java分库分表实现 | https://gitee.com/fengyuduke/my_open_resources/blob/master/sharding-jdbc-manualConfiguration.rar | ||
https://gitee.com/fengyuduke/my_open_resources/blob/master/sharding-jdbc-manualConfiguration.rar |
|||
nginx+tomcat负载均衡设置 | |||
参考:https://www.cnblogs.com/foxting/p/7993869.html |
|||
js回调函数的使用 | |||
<!DOCTYPE html> <html> <head> <title>js回调函数的使用</title> <script type="text/javascript"> function getInput(options, successcallback, errorcallback){ //确保callback是一个函数 if(typeof successcallback === "function"){ //调用它,既然我们已经确定了它是可调用的 var res = {}; res.username = options.username; res.classname = "高一1班"; successcallback(res); }else if (typeof errorcallback == "function"){ errorcallback("出错了"); } } function success(data) { alert("欢迎"+data.classname+":"+data.username); } function error(msg){ alert(msg); } getInput({username:"张珊"}, success, error); </script> </head> <body> </body> </html> |
|||
自己实现的下拉多选框 | 自己实现的下拉多选框 | ||
<html> <head> </head> <body> <div> <span>快捷按钮设置</span> <input type="text" id="p006_name" value="" style="width:350px;" readonly="readonly" /><img src="ars.PNG" style="position:relative;top:5px;height:20px;" onclick="contrlShortcutButtonLink()" /> <input type="text" id="p006_url" value="" style="width:550px;" readonly="readonly" /> <div id="shorcutButtonDiv" onmouseleave="contrlShortcutButtonLink()" style="display:none;position:relative;left:110px;border:1px solid black;width:150px;height:auto;z-index:8999;"></div> </div> <div> <div> <span>排序号</span><input type="text" value="" /> </div> </div> <div> <input type="button" value="发布" onclick="disployInfo()" /> </div> <script type="text/javascript"> function o(id , name, url){ this.id = id; this.name = name; this.url = url; } var o1 = new o("1","营业厅","www.baidu.com"); var o2 = new o("2","话费查询","www.iteye.com"); var o3 = new o("3","套餐查询","www.csdn.com"); var s = []; s.push(o1); s.push(o2); s.push(o3); var shtml = ''; var len = s.length; if(len > 5){ len = 5; } for(var i = 0; i < len; i++){ shtml += '<input type="checkbox" name="shortcutLinkBox" value="'+s[i].name+'####'+s[i].url+'" />'+s[i].name+'<br />'; } document.getElementById('shorcutButtonDiv').innerHTML = shtml; //alert(shtml); var _names = ''; var _urls = ''; function disployInfo(){ setShortcutButtonLinkVal(); alert(_names); alert(_urls); } function setShortcutButtonLinkVal(){ _names = ''; _urls = ''; document.getElementById("p006_name").value = ""; document.getElementById("p006_url").value = ""; var shortcutLinkBoxList = document.getElementsByName("shortcutLinkBox"); for(var i = 0; i < shortcutLinkBoxList.length; i++){ var _box = shortcutLinkBoxList[i]; if(_box.value != "" && _box.checked){ var _boxKV = _box.value.split("####"); _names += "," + _boxKV[0]; _urls += "," + _boxKV[1]; } //alert(_box.value+":"+_box.checked); } if(_names != ""){ _names = _names.substring(1); } if(_urls != ""){ _urls = _urls.substring(1); } document.getElementById("p006_name").value = _names; document.getElementById("p006_url").value = _urls; } var isYShowShortcutFlg = false; function contrlShortcutButtonLink(){ setShortcutButtonLinkVal(); if(isYShowShortcutFlg){ isYShowShortcutFlg = false; document.getElementById("shorcutButtonDiv").style.display="none"; }else{ isYShowShortcutFlg = true; document.getElementById("shorcutButtonDiv").style.display="block"; } } </script> </body> </html> |
|||
禁用鼠标点击事件 | 禁用鼠标点击事件 | ||
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Wheel</title> </head> <body id="bodyMe" onload="loadDiv()"> <div id="canvas" width="200" height="200" style="background-color:green;" onclick="clickMe()"><br /><br /></div> <input type="button" id="divContrlButton" value="禁用div的点击事件" onclick="clickBtn()"/> <!--阻止冒泡事件--> <div id="c1" onclick="c()" width="200" height="200" style="background-color:pink;"> <br /><br /> <div id="c2" onclick="c2()" width="200" height="100" style="background-color:green;"> <input type="button" id="c3" value="点击" onclick="alert(3)"> </div> </div> <script type="text/javascript"> var dflag = true; function clickMe(){ alert("click ..."); } function clickBtn(){ if(dflag){ //可拖动div //document.getElementById("canvas").onclick=function clickMe(){return true;}; document.getElementById("canvas").onclick="event.cancelBubble = true"; dflag = false; document.getElementById("divContrlButton").value="启用div的点击事件"; document.getElementById("bodyMe").onload=loadDiv; }else{ //可点击div document.getElementById("canvas").onclick=clickMe; dflag = true; document.getElementById("divContrlButton").value="禁用div的点击事件"; //document.getElementById("bodyMe").onload=function(){return true;}; document.getElementById("bodyMe").onload="event.cancelBubble = true"; } } function loadDiv(){ alert("loading....."); alert("load done。。。") document.getElementById("canvas").onclick="event.cancelBubble = true"; dflag = false; document.getElementById("divContrlButton").value="启用div的点击事件"; document.getElementById("bodyMe").onload=loadDiv; } document.getElementById('c2').addEventListener('click',function(e){e.stopPropagation()},false); document.getElementById('c3').addEventListener('click',function(e){e.stopPropagation()},false); function c(){ alert("1") } function c2(){ alert("2"); } </script> </body> </html> |
|||
div拖动、平移 | div拖动、平移 | ||
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>div鎵樺姩锛屾墦寮€锛屽叧闂晥鏋?/title> <style type="text/css">body,span,div,td{font-size:12px;line-height:1.5em;color:#849BCA;} #bodyL{ float:left; width:84px; margin-right:2px; } a.od{ width:80px; height:25px; line-height:25px; text-align:center; font-weight:bold; border: 2px solid #849BCA; display:block; color:#547BC9; float:left; text-decoration:none; margin-top:2px; } a.od:link{ background:#EEF1F8; } a.od:visited{ background:#EEF1F8; } a.od:hover{ background:#EEE; } a.od:active{ background:#EEE; } #Canvas{ width:500px; height:200px; background:#EDF1F8; border: 2px solid #849BCA; margin-top:2px; margin-left:2px; float:left; overflow:hidden; position:absolute; left:0px; top:0px; cursor:move; float:left; /*filter:alpha(opacity=50);*/ } .content{ padding:10px; }</style></head> <body> <div id="Canvas" style="display:block;filter:alpha(opacity=100);opacity:1;"> </div> <script type="text/javascript"> var prox; var proy; var proxc; var proyc; function openx(o, x) { /*--鎵撳紑x--*/ var cx = parseInt(o.style.width); if (cx < x) { o.style.width = (cx + Math.ceil((x - cx) / 5)) + "px"; } else { clearInterval(prox); proy = setInterval(function() { openy(o, 200) }, 10); } } function openy(o, y) { /*--鎵撳紑y--*/ var cy = parseInt(o.style.height); if (cy < y) { o.style.height = (cy + Math.ceil((y - cy) / 5)) + "px"; } else { clearInterval(proy); } } function closey(o) { /*--鎵撳紑y--*/ var cy = parseInt(o.style.height); if (cy > 0) { o.style.height = (cy - Math.ceil(cy / 5)) + "px"; } else { clearInterval(proyc); proxc = setInterval(function() { closex(o) }, 10); } } function closex(o) { /*--鎵撳紑x--*/ var cx = parseInt(o.style.width); if (cx > 0) { o.style.width = (cx - Math.ceil(cx / 5)) + "px"; } else { clearInterval(proxc); o.style.display = "none"; } } /*-------------------------榧犳爣鎷栧姩---------------------*/ var od = document.getElementById("Canvas"); var dx, dy, mx, my, mouseD; var odrag; var isIE = document.all ? true: false; document.onmousedown = function(e) { var e = e ? e: event; if (e.button == (document.all ? 1 : 0)) { mouseD = true; } } document.onmouseup = function() { mouseD = false; odrag = ""; if (isIE){ od.releaseCapture(); od.filters.alpha.opacity = 100; }else{ window.releaseEvents(od.MOUSEMOVE); od.style.opacity = 1; } } //function readyMove(e){ od.onmousedown = function(e) { odrag = this; var e = e ? e: event; if (e.button == (document.all ? 1 : 0)) { mx = e.clientX; my = e.clientY; od.style.left = od.offsetLeft + "px"; od.style.top = od.offsetTop + "px"; if (isIE) { od.setCapture(); od.filters.alpha.opacity = 50; } else { window.captureEvents(Event.MOUSEMOVE); od.style.opacity = 0.5; } //alert(mx); //alert(my); } } document.onmousemove = function(e) { var e = e ? e: event; //alert(mrx); //alert(e.button); if (mouseD == true && odrag) { var mrx = e.clientX - mx; var mry = e.clientY - my; od.style.left = parseInt(od.style.left) + mrx + "px"; od.style.top = parseInt(od.style.top) + mry + "px"; mx = e.clientX; my = e.clientY; } } </script> </body> </html> |
|||
html5拖动单个图标 | html5拖动单个图标 | ||
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>hangge.com</title> <style> canvas { cursor: pointer; border: 1px solid black; } </style> <script> // 这个方法用来储存每个圆圈对象 function Circle(x, y, radius, color) { this.x = x; this.y = y; this.radius = radius; this.color = color; this.isSelected = false; } // 保存画布上所有的圆圈 var circles = []; var canvas; var context; window.onload = function() { canvas = document.getElementById("canvas"); context = canvas.getContext("2d"); canvas.onmousedown = canvasClick; canvas.onmouseup = stopDragging; canvas.onmouseout = stopDragging; canvas.onmousemove = dragCircle; }; function addRandomCircle() { // 为圆圈计算一个随机大小和位置 var radius = randomFromTo(10, 60); var x = randomFromTo(0, canvas.width); var y = randomFromTo(0, canvas.height); // 为圆圈计算一个随机颜色 var colors = ["green", "blue", "red", "yellow", "magenta", "orange", "brown", "purple", "pink"]; var color = colors[randomFromTo(0, 8)]; // 创建一个新圆圈 var circle = new Circle(x, y, radius, color); // 把它保存在数组中 circles.push(circle); // 重新绘制画布 drawCircles(); } function clearCanvas() { // 去除所有圆圈 circles = []; // 重新绘制画布. drawCircles(); } function drawCircles() { // 清除画布,准备绘制 context.clearRect(0, 0, canvas.width, canvas.height); // 遍历所有圆圈 for(var i=0; i<circles.length; i++) { var circle = circles[i]; // 绘制圆圈 context.globalAlpha = 0.85; context.beginPath(); context.arc(circle.x, circle.y, circle.radius, 0, Math.PI*2); context.fillStyle = circle.color; context.strokeStyle = "black"; if (circle.isSelected) { context.lineWidth = 5; } else { context.lineWidth = 1; } context.fill(); context.stroke(); } } var previousSelectedCircle; function canvasClick(e) { // 取得画布上被单击的点 var clickX = e.pageX - canvas.offsetLeft; var clickY = e.pageY - canvas.offsetTop; // 查找被单击的圆圈 for(var i=circles.length-1; i>=0; i--) { var circle = circles[i]; //使用勾股定理计算这个点与圆心之间的距离 var distanceFromCenter = Math.sqrt(Math.pow(circle.x - clickX, 2) + Math.pow(circle.y - clickY, 2)) // 判断这个点是否在圆圈中 if (distanceFromCenter <= circle.radius) { // 清除之前选择的圆圈 if (previousSelectedCircle != null) previousSelectedCircle.isSelected = false; previousSelectedCircle = circle; //选择新圆圈 circle.isSelected = true; // 使圆圈允许拖拽 isDragging = true; //更新显示 drawCircles(); //停止搜索 return; } } } //在某个范围内生成随机数 function randomFromTo(from, to) { return Math.floor(Math.random() * (to - from + 1) + from); } var isDragging = false; function stopDragging() { isDragging = false; } function dragCircle(e) { // 判断圆圈是否开始拖拽 if (isDragging == true) { // 判断拖拽对象是否存在 if (previousSelectedCircle != null) { // 取得鼠标位置 var x = e.pageX - canvas.offsetLeft; var y = e.pageY - canvas.offsetTop; // 将圆圈移动到鼠标位置 previousSelectedCircle.x = x; previousSelectedCircle.y = y; // 更新画布 drawCircles(); } } } </script> </head> <body> <canvas id="canvas" width="400" height="300"> </canvas> <div> <button onclick="addRandomCircle()">添加圆圈</button> <button onclick="clearCanvas()">清空画布</button> </div> </body> </html> |
|||
html5 canvas平移-示例 | html5 canvas平移-示例 | ||
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>js div浮动层拖拽效果代码 - 站长素材</title> <script type="text/javascript"> function Drag() { //初始化 this.initialize.apply(this, arguments) } Drag.prototype = { //初始化 initialize : function (drag, options) { this.drag = this.$(drag); this._x = this._y = 0; this._moveDrag = this.bind(this, this.moveDrag); this._stopDrag = this.bind(this, this.stopDrag); this.setOptions(options); this.handle = this.$(this.options.handle); this.maxContainer = this.$(this.options.maxContainer); this.maxTop = Math.max(this.maxContainer.clientHeight, this.maxContainer.scrollHeight) - this.drag.offsetHeight; this.maxLeft = Math.max(this.maxContainer.clientWidth, this.maxContainer.scrollWidth) - this.drag.offsetWidth; this.limit = this.options.limit; this.lockX = this.options.lockX; this.lockY = this.options.lockY; this.lock = this.options.lock; this.onStart = this.options.onStart; this.onMove = this.options.onMove; this.onStop = this.options.onStop; this.handle.style.cursor = "move"; this.changeLayout(); this.addHandler(this.handle, "mousedown", this.bind(this, this.startDrag)) }, changeLayout : function () { this.drag.style.top = this.drag.offsetTop + "px"; this.drag.style.left = this.drag.offsetLeft + "px"; this.drag.style.position = "absolute"; this.drag.style.margin = "0" }, startDrag : function (event) { var event = event || window.event; this._x = event.clientX - this.drag.offsetLeft; this._y = event.clientY - this.drag.offsetTop; this.addHandler(document, "mousemove", this._moveDrag); this.addHandler(document, "mouseup", this._stopDrag); event.preventDefault && event.preventDefault(); this.handle.setCapture && this.handle.setCapture(); this.onStart() }, moveDrag : function (event) { var event = event || window.event; var iTop = event.clientY - this._y; var iLeft = event.clientX - this._x; if (this.lock) return; this.limit && (iTop < 0 && (iTop = 0), iLeft < 0 && (iLeft = 0), iTop > this.maxTop && (iTop = this.maxTop), iLeft > this.maxLeft && (iLeft = this.maxLeft)); this.lockY || (this.drag.style.top = iTop + "px"); this.lockX || (this.drag.style.left = iLeft + "px"); event.preventDefault && event.preventDefault(); this.onMove() }, stopDrag : function () { this.removeHandler(document, "mousemove", this._moveDrag); this.removeHandler(document, "mouseup", this._stopDrag); this.handle.releaseCapture && this.handle.releaseCapture(); this.onStop() }, //参数设置 setOptions : function (options) { this.options = { handle: this.drag, //事件对象 limit: true, //锁定范围 lock: false, //锁定位置 lockX: false, //锁定水平位置 lockY: false, //锁定垂直位置 maxContainer: document.documentElement || document.body, //指定限制容器 onStart: function () {}, //开始时回调函数 onMove: function () {}, //拖拽时回调函数 onStop: function () {} //停止时回调函数 }; for (var p in options) this.options[p] = options[p] }, //获取id $ : function (id) { return typeof id === "string" ? document.getElementById(id) : id }, //添加绑定事件 addHandler : function (oElement, sEventType, fnHandler) { return oElement.addEventListener ? oElement.addEventListener(sEventType, fnHandler, false) : oElement.attachEvent("on" + sEventType, fnHandler) }, //删除绑定事件 removeHandler : function (oElement, sEventType, fnHandler) { return oElement.removeEventListener ? oElement.removeEventListener(sEventType, fnHandler, false) : oElement.detachEvent("on" + sEventType, fnHandler) }, //绑定事件到对象 bind : function (object, fnHandler) { return function () { return fnHandler.apply(object, arguments) } } }; //应用 window.onload = function () { var oBox = document.getElementById("box"); var oTitle = document.getElementById("canvas"); var oDrag = new Drag(oBox, {handle:oTitle, limit:false}); var aInput = document.getElementsByTagName("input"); }; </script> </head> <body> <div id="box" style="background:lightblue;padding:5px;margin:50px;border:1px solid #f60;"> <canvas id="canvas" width="4000" height="300"> </canvas> </div> </body> </html> |
|||
表单校验checkform | 表单校验checkform | ||
1.jquery-checkform.js /** * jQuery checkForm * @Author Travis(LinYongji) * @Contact http://travisup.com/ * @Version 1.0.1 */ var savResultvalid = 0; /*表单校验是否成功标识,0表示成功,1表示失败--add by tanxingfu 2016-01-12*/ (function($) { var reg = { 'date': /^\d{4}-\d{2}-\d{2}$/, 'datetime': /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/, 'idcard': /(?:^\d{15}$)|(?:^\d{17}[\dxX]$)/, 'phone': /^1[358]\d{9}$/, 'email': /^[a-zA-Z0-9]+([_\.\-]\w+)*@\w+([_\.]\w+)*\.\w+([_\.]\w+)*$/, 'qq': /^[1-9]\d{4,9}$/, 'chinese': /^[\u4e00-\u9fa5]+$/, 'chinese_30': /^[\u4e00-\u9fa5]{2,6}$/, 'zf_255': /^\S{0,255}$/, 'eng' : /^[A-Za-z]+$/, 'chn' :/^[\u0391-\uFFE5]+$/, 'mail' : /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/, 'url' : /^http[s]?:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/, 'currency' : /^\d+(\.\d+)?$/, 'number' : /^\d+$/, 'ch_int' : /^[0-9]{1,11}$/, 'double' : /^[-\+]?\d+(\.\d+)?$/, 'username' : /^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/, 'password' : /^(\w){6,20}$/, 'cn_1':/^(\w){6,20}$/, 'safe' : />|<|,|\[|\]|\{|\}|\?|\/|\+|=|\||\'|\\|\"|:|;|\~|\!|\@|\#|\*|\$|\%|\^|\&|\(|\)|`/i, 'dbc' : /[a-zA-Z0-9!@#¥%^&*()_+{}[]|:"';.,/?<>`~ ]/, 'date' : /^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$/, 'year' : /^(19|20)[0-9]{2}$/, 'month' : /^(0?[1-9]|1[0-2])$/, 'day' : /^((0?[1-9])|((1|2)[0-9])|30|31)$/, 'hour' : /^((0?[1-9])|((1|2)[0-3]))$/, 'minute' : /^((0?[1-9])|((1|5)[0-9]))$/, 'second' : /^((0?[1-9])|((1|5)[0-9]))$/, 'mobile' : /^((\(\d{2,3}\))|(\d{3}\-))?13\d{9}$/, 'phone' : /^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/, 'zipcode' : /^((1[1-5])|(2[1-3])|(3[1-7])|(4[1-6])|(5[0-4])|(6[1-5])|71|(8[12])|91)\d{4}((19\d{2}(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(19\d{2}(0[13578]|1[02])31)|(19\d{2}02(0[1-9]|1\d|2[0-8]))|(19([13579][26]|[2468][048]|0[48])0229))\d{3}(\d|X|x)?$/, 'ip' : /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/, 'file': /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/, 'image' : /.+\.(jpg|gif|png|bmp)$/i, 'word' : /.+\.(doc|rtf|pdf)$/i, 'max_val_24': /^((2[0-4]{1})|(1[0-9]{1})|([0-9]{1}))$/, 'max_val_23': /^((2[0-3]{1})|(1[0-9]{1})|([0-9]{1}))$/, 'max_val_48': /^(([4]{1}[0-8]{1})|([1-3]{0,1}[0-9]{1})|[1-9]{1})$/, 'max_val_47': /^(([4]{1}[0-7]{1})|([1-3]{0,1}[0-9]{1})|[1-9]{1})$/, 'max_val_100w':/^(1000000|([1-9]{1}[0-9]{0,5})|([1-9]{1}))$/, 'max_val_99w':/^(([1-9]{1}[0-9]{0,5})|([1-9]{1}))$/, 'max_val_max':/^(100000000|([1-9]{1}[0-9]{0,7})|([1-9]{1}))$/, 'max_val_max_j1':/^(([1-9]{1}[0-9]{0,7})|([1-9]{1}))$/ }, def = { e: '', w: '', r: '', t: 'next', type: 'text', cpass: 'check-pass', cerror: 'check-error', formid: 'myformsId', /*表单id--add by tanxingfu 2016-01-12*/ optbtnId: 'optBtn', /*操作按钮id--add by tanxingfu 2016-01-12*/ validresback: '0' }; function tips($elem, t) { var $tips; if(t == 'next') { $tips = $elem.eq(-1).next(); } else if(t == 'prev') { $tips = $elem.eq(0).prev(); } else { $tips = $(t); } return $tips.removeClass(def.cpass).removeClass(def.cerror); } var errorimgtext = "<img src='images/onError.gif' style='vertical-align:middle;' />"; var successimgtext = "<img src='images/onSuccess.gif' style='vertical-align:middle;' />"; function text() { debugger var $elem = $(this).eq(0), o = $elem.data('checkform'), val = $elem.val(), $tips = tips($elem, o.t); if(o.e && !val) { $tips.html(errorimgtext).append(o.e).addClass(def.cerror); //$tips.addClass(def.cerror).text(o.e); return false; } if(val && o.w && o.r && !o.r.test(val)) { $tips.html(errorimgtext).append(o.w).addClass(def.cerror); //$tips.addClass(def.cerror).text(o.w); return false; } //$tips.addClass(def.cpass).text(''); $tips.html(successimgtext).addClass(def.cpass); return true; } function checked() { var $elem = this.filter(':checked'), o = this.eq(0).data('checkform'), val, i = 0, $tips = tips($elem, o.t); if(o.e && $elem.length === 0) { $tips.html(errorimgtext).append(o.e).addClass(def.cerror); //$tips.addClass(def.cerror).text(o.e); return false; } if(o.w && o.r) { for(; i < $elem.length; i++) { val = $elem.eq(i).val(); if(val && !o.r.test(val)) { $tips.html(errorimgtext).append(o.w).addClass(def.cerror); //$tips.addClass(def.cerror).text(o.w); return false; } } } //$tips.addClass(def.cpass).text(''); $tips.html(successimgtext).addClass(def.cpass); return true; } function submit(e) { var i, $elem, o = e.data, sign = 0, isvalid = 0;; for(i in o) { $elem = $(i); if(o[i].type == 'text' || o[i].type == 'select') { $elem[0] && !text.call($elem[0]) && sign++; } else if(o[i].type == 'radio' || o[i].type == 'checkbox') { $elem[0] && !checked.call($elem) && sign++; } if(!text.call($elem[0])){ /*判断校验结果--add by tanxingfu 2016-01-12*/ isvalid = 1; }/*判断校验结果--add by tanxingfu 2016-01-12*/ //console.info($elem[0]+"----"+(!text.call($elem[0]))+"------"+sign); } /*判断校验结果--add by tanxingfu 2016-01-12*/ if(isvalid == 0){ //0表示校验成功 savResultvalid = 0; return true; }else{ savResultvalid = 1; return false; } /*判断校验结果--add by tanxingfu 2016-01-12*/ } function setup(options) { var i; for(i in def) { if(options[i]) { def[i] = options[i]; } } return def; } function init(options) { var i, o, $elem; if(typeof options === 'undefined') { return; } for(i in options) { $elem = $(i); o = options[i]; o.r = reg[o.r] || o.r || def.r; o.w = o.w || def.w; o.e = o.e || def.e; o.t = o.t || def.t; o.type = o.type || def.type; $elem.eq(0).data('checkform', o) if(o.type == 'text') { $elem.eq(0).bind('blur', text); } } /*判断校验结果--update by tanxingfu 2016-01-12*/ //this.eq(0).bind('submit', options, submit); $("#"+def.optbtnId).bind('click', options, submit); //add bind event to button /*判断校验结果--update by tanxingfu 2016-01-12*/ } $.fn.checkForm = init; $.checkFormSetup = setup; })(jQuery); 2.demo5.html <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery checkForm</title> <style type="text/css"> .check-error{ font-size:12px; } </style> </head> <body> <form action="demo2.html" method="post" id="myform"> <h1>Register</h1> <p><label for="username">最大值: </label><input type="text" name="username" id="unames111"> <span style="color:red;"></span></p> <p><label for="email">Email: </label><input type="text" name="email" id="youxiaong"> <span style="color:red;"></span></p> <p><label for="password">月份: </label><input type="text" name="password" id="yuefengss"> <span style="color:red;"></span></p> <p> <input type="button" value="保存" id="submitbtn" /> <input type="button" value="返回" id="cancelbtn" /> </p> </form> <script type="text/javascript" src="js/jquery-1.9.0.min.js"></script> <script type="text/javascript" src="js/jquery.checkform.js"></script> <script type="text/javascript"> $.checkFormSetup({e: '',formid:'myform',optbtnId:'submitbtn'}); $("#myform").checkForm({ '#unames111': {e:'请输入用户名', w: '最大值为100000000.', r: 'max_val_max'}, '#yuefengss':{e:'请输入月份', w:'最大值为12', r:'month'}, '#youxiaong': {e: '请输入邮箱.', w: '请输入正确的邮箱.', r: 'email', t: 'next'} }); $("#cancelbtn").click(function(){ document.location.href="demo3.html"; }); $("#submitbtn").click(function(){ alert(savResultvalid); if(savResultvalid == 0){ document.location.href="demo2.html"; } }); </script> </body> </html> |
|||
Birt + SSH2 完整实践11 | |||
http://www.blogjava.net/SpartaYew/archive/2011/05/19/350618.html |
|||
Birt + SSH2 完整实践 | http://www.blogjava.net/SpartaYew/archive/2011/05/19/350618.html | ||
Birt + SSH2 完整实践 |
|||
birt集成web项目 | http://www.bubuko.com/infodetail-575071.html | ||
http://www.bubuko.com/infodetail-575071.html |
|||
jQuery插件flexigrid使用总结 | http://www.iteye.com/topic/611837 | http://www.iteye.com/topic/611837 | |
http://www.iteye.com/topic/611837 |
|||
自定义分页插件:paging.js | |||
/*自定义分页工具栏插件:paging.js*/ (function($){ $.fn.itemPage = function(options){ var defaults = {}; var options = $.extend(defaults, options); var data=options.data,//数据 currpage=options.currpage,//当前页 pagesize=options.pagesize;//每页显示的数据条目器 var total=data.total; var items=$("<div id='items'></div>"), pagectrl=$("<div id='page_ctrl'></div>"); var first=$("<div id=\"first\" class=\"page_ctrl\" onClick=\"showPage('first')\">首页</div>"), prev=$("<div id=\"prev\" class=\"page_ctrl\" onClick=\"showPage('prev')\">上一页</div>"), currPageVal=$("<div class=\"page_ctrl\" style=\"width:auto;background-color:white;\">"+currpage+"</div>"), next=$("<div id=\"next\" class=\"page_ctrl\" onClick=\"showPage('next')\">下一页</div>"), last=$("<div id=\"last\" class=\"page_ctrl\" onClick=\"showPage('last')\">尾页</div>"), pageSelectText=$("<div class=\"page_ctrl\" style='width:60px;background-color:white;'>每页显示</div>"), pageSelect=$("<div id=\"pageSelect\" class=\"page_ctrl\" style='float:left;width:auto;background-color:white;'>"+ "<select id=\"pageSize\">"+ "<option value=\""+pagesize+"\">"+pagesize+"</option>"+ "<option value=\"10\">10</option>"+ "</select>"+ "</div>"), totalPageText=$("<div class=\"page_ctrl\" style=\"width:auto;background-color:white;\">共"+total+"条记录</div>"); var start=getStartindex(), end=getEndindex(); pagectrl.append(pageSelectText), pagectrl.append(pageSelect), pagectrl.append(totalPageText), pagectrl.append(first), pagectrl.append(prev), pagectrl.append(currPageVal), pagectrl.append(next), pagectrl.append(last); var container = $(this); container.append(pagectrl); function getStartindex(){ return (currpage-1)*pagesize; } function getEndindex(){ var endIndex=0; if(data.total%pagesize!=0 && currpage==getLastPage()){ endIndex = data.total; } else { endIndex = currpage*pagesize; } return endIndex; } showItemInfo = function(i){ console.log(i); }; }; })(jQuery); |
|||
利用反射实现类的动态加载-2 | |||
//利用反射实现类的动态加载-2 /* 5.SaleListController.java */ package com.hp.controller; import java.io.FileInputStream; import java.io.InputStream; import java.util.List; import java.util.Properties; import com.hp.service.SaleListService; public class SaleListController { public String execute(){ String params = "20000"; //页面传过来的参数 //通过标志位的值去查找配置文件className.properties try{ Properties p = new Properties(); String path = this.getClass().getResource("/com/hp/properties/className.properties").getPath(); InputStream fis = new FileInputStream(path); p.load(fis); String res = p.getProperty(params); fis.close(); return res; }catch(Exception e){ e.printStackTrace(); return "00000"; } } public void handler(){ String result = execute(); String className = "com.hp.service.impl."+result; try{ Class c = Class.forName(className); SaleListService instance = (SaleListService)c.newInstance(); List list = instance.getList(); }catch(Exception e){ e.printStackTrace(); } } public static void main(String[] args) { SaleListController saleList = new SaleListController(); saleList.handler(); } } |
|||
利用反射实现类的动态加载-1 | |||
//利用反射实现类的动态加载-1 /* 1. SaleListService.java */ package com.hp.service; import java.util.List; public interface SaleListService { public List getList(); } /* 2. ASaleListServiceImpl.java */ package com.hp.service.impl; import java.util.List; import com.hp.service.SaleListService; public class ASaleListServiceImpl implements SaleListService{ public List getList() { System.out.println("返回销售清单A的List..."); return null; } } /* 3. BSaleListServiceImpl.java */ package com.hp.service.impl; import java.util.List; import com.hp.service.SaleListService; public class BSaleListServiceImpl implements SaleListService{ public List getList() { System.out.println("返回销售清单B的List..."); return null; } } #4.className.properties放在包com.hp.properties中 #这里配置接口的实现类 #销售清单A 10000=ASaleListServiceImpl #销售清单B 20000=BSaleListServiceImpl |
|||
linux连接工具和hibernate中的Query查询的参数设置新方式 | |||
hibernate中的Query查询的参数设置新方式: String uid = "s123"; String sql = "select * from tb_user where userid = :userId"; Query query = SessionFactory.getSession().createQuery(sql); query.setParameter("userId", uid); List list = query.list(); String loginUserId = "s221"; String sql = "select r.rolename, d.deptname "+ "from tb_role r , tb_dept d "+ "where r.userid = :userid and d.userid = :userid"; Query query = SessionFactory.getSession().createQuery(sql); query.setParameterList("userId", loginUserId); List list = query.list(); ----------------------------------------- linux连接工具:Xmanager |
|||
7.birt报表在spring控制器中的应用示例demo-3(demo.rptdesign文件第七部分) | |||
7.birt报表在spring控制器中的应用示例demo-3(demo.rptdesign文件第七部分) <detail> <row id="191"> <property name="style">column-style</property> <property name="textAlign">center</property> <property name="verticalAlign">middle</property> <property name="height">0.3645833333333333in</property> <cell id="193"> <property name="style">column-cell</property> <data id="242"> <property name="style">column-font</property> <structure name="dateTimeFormat"> <property name="category">Custom</property> <property name="pattern">yyyy-MM-dd HH:mm:ss</property> </structure> <property name="resultSetColumn">recv_time</property> </data> </cell> <cell id="196"> <property name="style">column-cell</property> <data id="245"> <property name="style">column-font</property> <property name="resultSetColumn">od_state</property> </data> </cell> <cell id="198"> <property name="style">column-cell</property> <data id="247"> <property name="style">column-font</property> <property name="resultSetColumn">totalCount</property> </data> </cell> <cell id="200"> <property name="style">column-cell</property> <data id="249"> <property name="style">column-font</property> <property name="resultSetColumn">doneCount</property> </data> </cell> <cell id="201"> <property name="style">column-cell</property> <data id="250"> <property name="style">column-font</property> <list-property name="highlightRules"> <structure> <property name="operator">eq</property> <property name="fontSize">16pt</property> <property name="color">#FF0000</property> <expression name="testExpr" type="javascript">row["doneRate"]</expression> <simple-property-list name="value1"> <value type="javascript">"-"</value> </simple-property-list> </structure> </list-property> <property name="resultSetColumn">doneRate</property> </data> </cell> </row> </detail> </table> </body> </report> |
|||
6.birt报表在spring控制器中的应用示例demo-3(demo.rptdesign文件第六部分) | |||
6.birt报表在spring控制器中的应用示例demo-3(demo.rptdesign文件第六部分) <header> <row id="178"> <property name="style">header-style</property> <property name="fontFamily">"微软雅黑"</property> <property name="fontWeight">bold</property> <property name="verticalAlign">middle</property> <property name="height">0.5104166666666666in</property> <cell id="180"> <property name="style">header-cell</property> <text id="230"> <property name="style">header-font</property> <property name="contentType">auto</property> <text-property name="content"><![CDATA[处理时间]]></text-property> </text> </cell> <cell id="183"> <property name="style">header-cell</property> <text id="233"> <property name="style">header-font</property> <property name="contentType">auto</property> <text-property name="content"><![CDATA[值班状态]]></text-property> </text> </cell> <cell id="185"> <property name="style">header-cell</property> <text id="235"> <property name="style">header-font</property> <property name="contentType">auto</property> <text-property name="content"><![CDATA[总数 (个)]]></text-property> </text> </cell> <cell id="187"> <property name="style">header-cell</property> <text id="237"> <property name="style">header-font</property> <property name="contentType">auto</property> <text-property name="content"><![CDATA[已处理个数 (个)]]></text-property> </text> </cell> <cell id="188"> <property name="style">header-cell</property> <text id="238"> <property name="style">header-font</property> <property name="contentType">auto</property> <text-property name="content"><![CDATA[处理率 (%)]]></text-property> </text> </cell> </row> </header> |
|||
5.birt报表在spring控制器中的应用示例demo-3(demo.rptdesign文件第五部分) | |||
5.birt报表在spring控制器中的应用示例demo-3(demo.rptdesign文件第五部分) <structure> <property name="name">doneRate</property> <text-property name="displayName">doneRate</text-property> <expression name="expression" type="javascript">var onetDoneRateRes; if(dataSetRow["totalCount"] == 0){ onetDoneRateRes = "-"; }else{ onetDoneRateRes = dataSetRow["doneRate"]; } onetDoneRateRes;</expression> <property name="dataType">javaObject</property> <property name="allowExport">true</property> </structure> <structure> <property name="name">avgTime</property> <text-property name="displayName">avgTime</text-property> <expression name="expression" type="javascript">var oneTktAvgTime; if(dataSetRow["totalCount"] == 0){ oneTktAvgTime = "-"; }else{ oneTktAvgTime = dataSetRow["avgTime"]; } oneTktAvgTime</expression> <property name="dataType">javaObject</property> <property name="allowExport">true</property> </structure> </list-property> <column id="218"> <property name="width">1.6354166666666667in</property> </column> <column id="221"> <property name="width">0.90625in</property> </column> <column id="223"> <property name="width">1.2916666666666667in</property> </column> <column id="225"> <property name="width">1.21875in</property> </column> <column id="226"> <property name="width">1.25in</property> </column> |
|||
4.birt报表在spring控制器中的应用示例demo-3(demo.rptdesign文件第四部分) | |||
4.birt报表在spring控制器中的应用示例demo-3(demo.rptdesign文件第四部分) <body> <table id="177"> <property name="width">100%</property> <property name="dataSet">oneticketScriptDataCollection</property> <list-property name="boundDataColumns"> <structure> <property name="name">recv_time</property> <text-property name="displayName">recv_time</text-property> <expression name="expression" type="javascript">dataSetRow["recv_time"]</expression> <property name="dataType">date-time</property> </structure> <structure> <property name="name">od_state</property> <text-property name="displayName">od_state</text-property> <expression name="expression" type="javascript">dataSetRow["od_state"]</expression> <property name="dataType">string</property> </structure> <structure> <property name="name">totalCount</property> <text-property name="displayName">totalCount</text-property> <expression name="expression" type="javascript">dataSetRow["totalCount"]</expression> <property name="dataType">integer</property> </structure> <structure> <property name="name">doneCount</property> <text-property name="displayName">doneCount</text-property> <expression name="expression" type="javascript">dataSetRow["doneCount"]</expression> <property name="dataType">integer</property> </structure> |
|||
3. birt报表在spring控制器中的应用示例demo-2(demo.rptdesign文件第三部分) | |||
3. birt报表在spring控制器中的应用示例demo-2(demo.rptdesign文件第三部分) <styles> <style name="report" id="4"> <property name="fontFamily">sans-serif</property> <property name="fontSize">10pt</property> </style> <style name="crosstab-cell" id="5"> <property name="borderBottomColor">#CCCCCC</property> <property name="borderBottomStyle">solid</property> <property name="borderBottomWidth">1pt</property> <property name="borderLeftColor">#CCCCCC</property> <property name="borderLeftStyle">solid</property> <property name="borderLeftWidth">1pt</property> <property name="borderRightColor">#CCCCCC</property> <property name="borderRightStyle">solid</property> <property name="borderRightWidth">1pt</property> <property name="borderTopColor">#CCCCCC</property> <property name="borderTopStyle">solid</property> <property name="borderTopWidth">1pt</property> </style> <style name="crosstab" id="6"> <property name="borderBottomColor">#CCCCCC</property> <property name="borderBottomStyle">solid</property> <property name="borderBottomWidth">1pt</property> <property name="borderLeftColor">#CCCCCC</property> <property name="borderLeftStyle">solid</property> <property name="borderLeftWidth">1pt</property> <property name="borderRightColor">#CCCCCC</property> <property name="borderRightStyle">solid</property> <property name="borderRightWidth">1pt</property> <property name="borderTopColor">#CCCCCC</property> <property name="borderTopStyle">solid</property> <property name="borderTopWidth">1pt</property> </style> </styles> <page-setup> <simple-master-page name="NewSimpleMasterPage" id="7"/> </page-setup> |
|||
2. birt报表在spring控制器中的应用示例demo-2(demo.rptdesign文件第二部分) | |||
2. birt报表在spring控制器中的应用示例demo-2(demo.rptdesign文件第二部分) <structure name="cachedMetaData"> <list-property name="resultSet"> <structure> <property name="position">2</property> <property name="name">recv_time</property> <property name="dataType">date-time</property> </structure> <structure> <property name="position">5</property> <property name="name">od_state</property> <property name="dataType">string</property> </structure> <structure> <property name="position">7</property> <property name="name">totalCount</property> <property name="dataType">integer</property> </structure> <structure> <property name="position">9</property> <property name="name">doneCount</property> <property name="dataType">integer</property> </structure> <structure> <property name="position">10</property> <property name="name">doneRate</property> <property name="dataType">float</property> </structure> <structure> <property name="position">11</property> <property name="name">avgTime</property> <property name="dataType">float</property> </structure> </list-property> </structure> <property name="dataSource">oneticketScriptDatasource</property> <method name="open"><![CDATA[count = 0; oneticketListBean = listBean;]]></method> <method name="fetch"><![CDATA[if(count < oneticketListBean.size()){ row["recv_time"] = oneticketListBean.get(count).getRecv_time(); if("2".equals(oneticketListBean.get(count).getOd_state())){ row["od_state"] = "已完成"; } row["totalCount"] = oneticketListBean.get(count).getTotalCount(); if(null == oneticketListBean.get(count).getTotalCount()){ row["totalCount"] = 0; } row["doneCount"] = oneticketListBean.get(count).getDoneCount(); if(null == oneticketListBean.get(count).getDoneCount()){ row["doneCount"] = 0; } row["doneRate"] = oneticketListBean.get(count).getDoneRate(); if(null == oneticketListBean.get(count).getDoneRate()){ row["doneRate"] = 100; } count++; return true; } return false;]]></method> </script-data-set> </data-sets> |
|||
birt报表在spring控制器中的应用示例demo-2(demo.rptdesign文件第一部分) | |||
1. birt报表在spring控制器中的应用示例demo-2(demo.rptdesign文件第一部分) <?xml version="1.0" encoding="UTF-8"?> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1"> <property name="createdBy">Eclipse BIRT 设计器 V4.4.0.v201405191524 构建 <4.4.0.v20140606-1451></property> <property name="units">in</property> <property name="iconFile">/templates/blank_report.gif</property> <property name="layoutPreference">auto layout</property> <property name="bidiLayoutOrientation">ltr</property> <property name="imageDPI">96</property> <list-property name="cssStyleSheets"> <structure> <property name="fileName">/reports/css/epms.css</property> <property name="useExternalCss">true</property> <property name="externalCssURI">/reports/css/epms.css</property> </structure> </list-property> <data-sources> <script-data-source name="oneticketScriptDatasource" id="8"/> </data-sources> <data-sets> <script-data-set name="oneticketScriptDataCollection" id="9"> <list-property name="resultSetHints"> <structure> <property name="position">1</property> <property name="name">recv_time</property> <property name="dataType">date-time</property> </structure> <structure> <property name="position">4</property> <property name="name">od_state</property> <property name="dataType">string</property> </structure> <structure> <property name="position">6</property> <property name="name">totalCount</property> <property name="dataType">integer</property> </structure> <structure> <property name="position">8</property> <property name="name">doneCount</property> <property name="dataType">integer</property> </structure> <structure> <property name="position">9</property> <property name="name">doneRate</property> <property name="dataType">float</property> </structure> <structure> <property name="position">10</property> <property name="name">avgTime</property> <property name="dataType">float</property> </structure> </list-property> <list-property name="columnHints"> <structure> <property name="columnName">recv_time</property> </structure> <structure> <property name="columnName">od_state</property> </structure> <structure> <property name="columnName">totalCount</property> </structure> <structure> <property name="columnName">doneCount</property> </structure> <structure> <property name="columnName">doneRate</property> </structure> <structure> <property name="columnName">avgTime</property> </structure> </list-property> |
|||
birt报表在spring控制器中的应用示例demo | |||
/**查询报表数据*/ @RequestMapping(method=RequestMethod.GET, value="/queryData") @ResponseBody public void queryData(HttpServletRequest request , HttpServletResponse response) { IRunAndRenderTask task = null; getGanmovstaService(); ServletContext sc = request.getSession().getServletContext(); String reportFile = "reports/user/user_report.rptdesign"; // 显示到报表的list int pageCurrent = 1; //当前页 int pageRecord = 10; //每页显示总记录数 //查询相应的统计数据 try{ reportFile = sc.getRealPath(reportFile); initReportEngine(sc); design = reportEngine.openReportDesign(reportFile); task = reportEngine.createRunAndRenderTask(design); List<UserPojo> ondutyList = userService.queryGanmovstaData(pageCurrent, pageRecord); task.addScriptableJavaObject("listBean", ondutyList); HTMLRenderOption option = new HTMLRenderOption(); option.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML); option.setOutputStream(response.getOutputStream()); task.setRenderOption(option); task.run(); }catch(IOException e){ log.error("Io异常", e); }catch(EngineException e){ log.error("报表引擎异常", e); }finally{ if(task != null){ task.close(); } } } /**导出报表*/ @RequestMapping(method = RequestMethod.GET, value = "/ganmovstaRepExport") @ResponseBody public void ganmovstaRepExport(HttpServletRequest request,HttpServletResponse response){ String pageNum = "1"; int pageRecord = userService.serachPage("1"); //总记录数 IRunAndRenderTask task = null; ServletContext sc = request.getSession().getServletContext(); initReportEngine(sc); //显示到报表的list List<UserPojo> ondutyList = null; getGanmovstaService(); try{ allList = userService.queryGanmovstaData(pageNum, pageRecord); }catch(Exception e){ log.error(e.getMessage()); } //查询相应的统计数据 String fname = "reports/user/user_report.rptdesign"; String reportFile = sc.getRealPath(fname); try{ initReportEngine(sc); design = reportEngine.openReportDesign(reportFile); task = reportEngine.createRunAndRenderTask(design); // 返回报表实体列表 task.addScriptableJavaObject("listBean", allList); //生成的目标文件 String fileName = "reports/user/user_report_des" + "." + ExportFormat.FORMAT_EXCEL; response.reset(); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition","attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); RenderOption option = new EXCELRenderOption(); option.setOutputFormat(ExportFormat.FORMAT_EXCEL); option.setOutputStream(response.getOutputStream()); task.setRenderOption(option); task.run(); response.flushBuffer(); }catch(IOException e){ log.error("Io异常", e); }catch(EngineException e){ log.error("报表引擎异常", e); }finally{ if(task != null){ task.close(); } } } |
|||
获取MAC地址 | |||
package com.birt.analysis; import java.io.InputStreamReader; import java.io.LineNumberReader; public class GetMacAddressUtil { /**读取本地MAC地址*/ public void getMacAddress(){ try{ String cmd = "cmd /c ipconfig /all"; Process p = Runtime.getRuntime().exec(cmd); InputStreamReader bis = new InputStreamReader(p.getInputStream()); LineNumberReader lnr = new LineNumberReader(bis); String s = null; while((s = lnr.readLine()) != null){ if(s.contains("物理地址")){ System.out.println(s); break; } } lnr.close(); bis.close(); p.destroy(); }catch(Exception e){ e.printStackTrace(); } } public static void main(String[] args) { GetMacAddressUtil gau = new GetMacAddressUtil(); gau.getMacAddress(); } } |
|||
quartz使用 | |||
quartz使用 1. ScheduerJob.java package com.hp.job; /** * 定时任务: * 第一步:编写任务类 :该类为一个普通的类 */ public class ScheduerJob { public void dojob(){ System.out.println("执行任务中..."); } } 2.spring配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <context:annotation-config /> <!-- 第二步:配置作业类 这一步是关键步骤,声明一个MethodInvokingJobDetailFactoryBean, 有两个关键属性:targetObject指定任务类,targetMethod指定运行的方法 --> <bean id="jobme" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject"> <bean class="com.hp.job.ScheduerJob"></bean> </property> <property name="targetMethod" value="dojob"></property> <property name="concurrent" value="false"></property><!-- 作业不并发调度 --> </bean> <!-- 第三步:配置触发器(即作业调度的触发方式) 1):SimpleTriggerBean,只支持按照一定频度调用任务,如每隔30分钟运行一次 --> <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> <property name="jobDetail" ref="jobme"></property> <!-- 调度工厂实例化后,经过0秒开始执行调度 --> <property name="startDelay" value="0"></property> <!-- 每2秒调度一次 --> <property name="repeatInterval" value="2000"></property> </bean> <!-- 第三步:配置触发器(即作业调度的触发方式) 2):CronTriggerBean,支持到指定时间运行一次,如每天12:00运行一次等 --> <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="jobme"></property> <!-- 每天12:00运行一次 --> <property name="cronExpression" value="0 0 12 * * ?" /> </bean> <!-- 第四步:配置调度工厂 --> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="cronTrigger"></ref> </list> </property> </bean> </beans> quartz使用 |
|||
quartz使用 | |||
quartz使用 1. ScheduerJob.java package com.hp.job; /** * 定时任务: * 第一步:编写任务类 :该类为一个普通的类 */ public class ScheduerJob { public void dojob(){ System.out.println("执行任务中..."); } } 2.spring配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <context:annotation-config /> <!-- 第二步:配置作业类 这一步是关键步骤,声明一个MethodInvokingJobDetailFactoryBean, 有两个关键属性:targetObject指定任务类,targetMethod指定运行的方法 --> <bean id="jobme" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject"> <bean class="com.hp.job.ScheduerJob"></bean> </property> <property name="targetMethod" value="dojob"></property> <property name="concurrent" value="false"></property><!-- 作业不并发调度 --> </bean> <!-- 第三步:配置触发器(即作业调度的触发方式) 1):SimpleTriggerBean,只支持按照一定频度调用任务,如每隔30分钟运行一次 --> <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> <property name="jobDetail" ref="jobme"></property> <!-- 调度工厂实例化后,经过0秒开始执行调度 --> <property name="startDelay" value="0"></property> <!-- 每2秒调度一次 --> <property name="repeatInterval" value="2000"></property> </bean> <!-- 第三步:配置触发器(即作业调度的触发方式) 2):CronTriggerBean,支持到指定时间运行一次,如每天12:00运行一次等 --> <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="jobme"></property> <!-- 每天12:00运行一次 --> <property name="cronExpression" value="0 0 12 * * ?" /> </bean> <!-- 第四步:配置调度工厂 --> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="cronTrigger"></ref> </list> </property> </bean> </beans> |