`
s284745061
  • 浏览: 25207 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
收藏列表
标题 标签 来源
Invalid property 'houseKeepingSleepTime' of bean Proxool houseKeepingSleepTime bug修正
 /**
     * @see ConnectionPoolDefinitionIF#getHouseKeepingSleepTime
     */
    public long getHouseKeepingSleepTime() {
        return houseKeepingSleepTime;
    }

    /**
     * @see ConnectionPoolDefinitionIF#getHouseKeepingSleepTime
     */
    public void setHouseKeepingSleepTime(int houseKeepingSleepTime) {
        this.houseKeepingSleepTime = houseKeepingSleepTime;
    }
2345678 近乎完美的简单 JS 跨域解决方式 --window.name
(function() {

    var _isIE = (
        navigator.appName == "Microsoft Internet Explorer"
    );

    var _removeNode = _isIE ? function() {
        var d;
        return function(n) {
            if(n && n.tagName != 'BODY') {
                d = d || document.createElement('div');
                d.appendChild(n);
                d.innerHTML = '';
            }
        }
    }() : function(n) {
        if(n && n.parentNode && n.tagName != 'BODY') {
            n.parentNode.removeChild(n);
        }
    };


/* [ Request by window.name ]
 * ****************************************************************************
   借助 Window.name 实现 Js 的跨域访问。
   1、 url 向外传值, callback 处理返回结果。
   2、 返回页面中 JS 对 window.name 赋值。

   返回页
   <script language="JavaScript">
       window.name = ...  // 支持 JSON 字符串,可达~2MB
   </script>

   若需同时进行多个请求,回调函数应是不同的函数实例。
   iframe 的自由载入形成了异步机制。
*/

    wnRequest = {
        _doc: document,
        _proxyUrl: 'proxy.html'
    };

    wnRequest.send = function( url, callback )
    {
        if(! url || typeof url !== 'string') {
            return;
        }
        url += (url.indexOf('?') > 0 ? '&' : '?') + 'windowname=get';

        var frame = this._doc.createElement('iframe');
        frame._state = 0;
        this._doc.body.appendChild(frame);
        frame.style.display = 'none';

        (function( el, type, fn ) {
            if (_isIE) {
                el.attachEvent('on' + type, fn);
            } else {
                el.addEventListener(type, fn, false);
            }
        })(frame, 'load', function() {
            if(frame._state == 1) {
                _getData(frame, callback);
            } else if(frame._state == 0) {
                frame._state = 1;
                //frame.contentWindow.location = wnRequest._proxyUrl;
                frame.contentWindow.location.replace(wnRequest._proxyUrl);
            }
        });
        frame.src = url;
    };

    //
    // 设置异域 Js 可访问的本地数据,客户端直接站间转递数据
    // 注:
    // 即浏览器直接将数据转递给另一个域的窗口,数据不上网。
    // 返回页代码:
    // <script type="text/javascript">
    //     if (window.name) {
    //         //... 处理 name 值
    //         window.name = null;
    //     }
    //     // 升为顶级窗口,完成数据转递
    //     try {
    //         top.location.hostname;
    //         if (top.location.hostname != window.location.hostname) {
    //             top.location.href =window.location.href;
    //         }
    //     } catch(e) {
    //         top.location.href = window.location.href;
    //     }
    // </script>
    //
    //
    wnRequest.setname = function( name, url ) {
        if(! url || typeof url !== 'string') {
            return;
        }
        url += (url.indexOf('?') > 0 ? '&' : '?') + 'windowname=loc';

        var frame = this._doc.createElement('iframe');
        frame._count = 0;
        this._doc.body.appendChild(frame);
        frame.style.display = 'none';
        if (_isIE) {
            frame.name = name;
        } else {
            frame.contentWindow.name = name;
        }
        frame.src = url;
    };

    //
    // 私用辅助
    //
    var _clear = function(frame) {
        try {
            frame.contentWindow.document.write('');
            frame.contentWindow.close();
            _removeNode(frame);
        } catch(e) {}
    }

    var _getData = function(frame, callback) {
        try {
            var da = frame.contentWindow.name;
        } catch(e) {}
        _clear(frame);
        if(callback && typeof callback === 'function') {
            callback(da);
        }
    }

})();
111111111 jquery和springmvc多文件上传
slave.name = (slave.name || $(MASTER).attr('name') || 'file');// + (slave.i>0?slave.i:''); // same name as master element
jQuery的一些处理表单的方法
$('#id').MultiFile({
		  accept: 'gif|jpg|png|bmp|swf|doc|ppt|xls|xlsx|mdb|mmp|pdf|zip|rar|txt', 
		  STRING: {
		    remove:'删除',
		    selected:'Selecionado: $file',
		    denied:'不符合要求的文件类型 $ext!',
		    duplicate:'请不要重复选择:\n$file!'
		   }
	  });
struts1.2和jquery.MultiFile.js实现多文件上传
<html:form action="/uploadFile.do" method="post" enctype="multipart/form-data" <span style="color: #ff0000;">onsubmit="$(':file').each(function(i){this.name=i;});return true;"></span>
   <html:file property="file" styleClass="multi" maxlength="5"></html:file><br>
   <html:submit /> 
</html:form>
CKEditor 3.6 入门
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>CKEditor</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
  </head>
  
  <body>
		<form id="form1" name="form1" method="post" action="display.jsp">
			<table width="650" height="400" border="0" align="center">
				<tr>
					<td valign="top">
						内容:
					</td>
					<td>
						<textarea id="editor1" name="editor1">&lt;p&gt;Initial value.&lt;/p&gt;</textarea>
						<script type="text/javascript">
							CKEDITOR.replace( 'editor1' );
						</script>
					</td>
				</tr>
				<tr>
					<td></td>
					<td>
						<input type="submit" name="Submit" value="提交" />
						<input type="reset" name="Reset" value="重置" />
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
itext pdf 我和iText的第一次亲密接触
Document document = new Document(PageSize.A4.rotate());
poi word poi读取word中的表格
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.hwpf.usermodel.Table;
import org.apache.poi.hwpf.usermodel.TableCell;
import org.apache.poi.hwpf.usermodel.TableIterator;
import org.apache.poi.hwpf.usermodel.TableRow;

import java.io.File;   
import java.io.FileInputStream;   
import java.io.InputStream;   
  
import org.apache.poi.POIXMLDocument;   
import org.apache.poi.POIXMLTextExtractor;   
import org.apache.poi.hwpf.extractor.WordExtractor;   
import org.apache.poi.openxml4j.opc.OPCPackage;   
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;  


import org.apache.poi.poifs.filesystem.POIFSFileSystem;

public class ExportDocImpl
{
	public void testWord(){
		try{
		    FileInputStream in = new FileInputStream("D:\\sinye.doc");//载入文档
		   POIFSFileSystem pfs = new POIFSFileSystem(in);   
		    HWPFDocument hwpf = new HWPFDocument(pfs);   
		    Range range = hwpf.getRange();//得到文档的读取范围
		    TableIterator it = new TableIterator(range);
		   //迭代文档中的表格
		    while (it.hasNext()) {   
		        Table tb = (Table) it.next();   
		        //迭代行,默认从0开始
		        for (int i = 0; i < tb.numRows(); i++) {   
		            TableRow tr = tb.getRow(i);   
		            //迭代列,默认从0开始
		            for (int j = 0; j < tr.numCells(); j++) {   
		                TableCell td = tr.getCell(j);//取得单元格
		                //取得单元格的内容
		                for(int k=0;k<td.numParagraphs();k++){   
		                    Paragraph para =td.getParagraph(k);   
		                    String s = para.text();   
		                    System.out.println(s);
		                } //end for    
		            }   //end for
		        }   //end for
		    } //end while
		}catch(Exception e){
			e.printStackTrace();
		}
	}//end method
	
	
           public void testWord1(){
           try {   
            //word 2003: 图片不会被读取   
            InputStream is = new FileInputStream(new File("D:\\sinye.doc"));   
                  WordExtractor ex = new WordExtractor(is);   
                  String text2003 = ex.getText();   
                  System.out.println(text2003);   
            //word 2007 图片不会被读取, 表格中的数据会被放在字符串的最后   
            OPCPackage opcPackage = POIXMLDocument.openPackage("D:\\sinye.doc");   
                  POIXMLTextExtractor extractor = new XWPFWordExtractor(opcPackage);   
                  String text2007 = extractor.getText();   
                  System.out.println(text2007);   
               
        } catch (Exception e) {   
                  e.printStackTrace();   
        } 
    }
}
Global site tag (gtag.js) - Google Analytics