<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>cai555</title>
    <description>YouMonitor.Us ... And we'll monitor for you!
Join the web's first and only global &quot;Neighborhood Watch&quot;
for websites.  Simple, Fast, Easy, and FREE!
http://YouMonitor.Us</description>
    <link>http://cai555.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
      <item>
        <title>在eclipse里面调试opencms模块代码</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/211708" style="color:red;">http://cai555.javaeye.com/blog/211708</a>&nbsp;
          发表时间: 2008年07月04日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>a. 安装tomcatPlugin</p>
<p>b. 在本机安装opencms</p>
<p>c. 进入eclipse，进入/window/Preferences.../Tomcat/sourcePath</p>
<p>d. 设置你的模块的工程为sourcePath，等会儿debug的时候eclipse就到这里找原代码</p>
<p>e. 使用tomcatPlugin启动tomcat</p>
<p>f. 设置断点，调试</p>
<p>&nbsp;</p>
<p>由于时间比较久，所以只记得这些，建议如果有疑问可以google一下。</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/211708#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 04 Jul 2008 17:09:13 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/211708</link>
        <guid>http://cai555.javaeye.com/blog/211708</guid>
      </item>
      <item>
        <title>REALVIZ Sticher</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/206926" style="color:red;">http://cai555.javaeye.com/blog/206926</a>&nbsp;
          发表时间: 2008年06月22日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>今天周末,抽了点时间研究了一下REALVIZ Sticher 一个全景照片生成工具,通过它可以将普通的数码相机拍得照片,转换成3D全景影像。接下来，把一些细节的东西记下来，留作备忘：</p>
<p>&nbsp;</p>
<p>１<span style="color: #006600;">．</span>
 制作一组全景图片的步骤和注意的问题。 <br />
<span style="color: #006600;">（</span>
１<span style="color: #006600;">）</span>
使照像机平行于地面并最好固定在三角架上。 <br />
<span style="color: #006600;">（</span>
２<span style="color: #006600;">）</span>
拍摄每一幅照片时要保持照像机在同一个高度。 <br />
<span style="color: #006600;">（</span>
３<span style="color: #006600;">）</span>
以一个固定点为圆心<span style="color: #006600;">，</span>
顺时针方向旋转拍摄每一幅照片。 <br />
<span style="color: #006600;">（</span>
４<span style="color: #006600;">）</span>
每一幅照片的边界要有３０<span style="color: #006600;">％</span>
左右的重叠区域。 <br />
<span style="color: #006600;">（</span>
５<span style="color: #006600;">）</span>
要注意将移动的物体拍摄在照片的中间<span style="color: #006600;">，</span>
不要让移动物体出现的照片相交错的边界上<span style="color: #006600;">，</span>
以免对以后照片的边界处理带来不便。 <br />
<span style="color: #006600;">（</span>
６<span style="color: #006600;">）</span>
根据你使用的照像设备的不同<span style="color: #006600;">，</span>
使用扫描仪等设备将照片处理成JPG格式的图片文件<span style="color: #006600;">，</span>
图片的尺寸可根据你自己的需要决定<span style="color: #006600;">，</span>
文件名最好按字母顺序排列。</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>2.如何在REALVIZ Sticher拖动生成的3D图片。</p>
<p>（1）使用REALVIZ Sticher打开你刚拍好的照片，使用Automatic stitch自动拼接照片生成3D照片。</p>
<p>（2）按住ctrl使用鼠标拖动，就可以使3d照片旋转起来。在&ldquo;Enter or Quite Movie Tools&rdquo;（就是在把3D照片导成视频的那个菜单里面）里面则是按住alt键，然后拖动鼠标。</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/206926#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sun, 22 Jun 2008 22:32:58 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/206926</link>
        <guid>http://cai555.javaeye.com/blog/206926</guid>
      </item>
      <item>
        <title>HTML Select  下拉菜单功能扩展</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/206513" style="color:red;">http://cai555.javaeye.com/blog/206513</a>&nbsp;
          发表时间: 2008年06月21日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>忙里偷闲，抽空写了一个HTML Select&nbsp; 下拉菜单的AJAX功能扩展，自己觉得用起来还蛮方便，写个blog备忘一下，同时也可以拿出来个大家共享，这里只给出demo,详细请看代码的注释，但愿我的注释够详细。</p>
<p>&nbsp;</p>
<pre name="code" class="html">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf8&quot; /&gt;
&lt;title&gt;Yoyoor&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/mootools-release-1.11.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/mootoolsAjaxExt.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/selectExt.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;select id=&quot;ajaxSelect&quot; url=&quot;data.js&quot;&gt;&lt;/select&gt;
&lt;select id=&quot;ajaxSelect2&quot;&gt;&lt;/select&gt;
&lt;select id=&quot;ajaxSelect3&quot; url=&quot;data.js&quot;&gt;&lt;/select&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
window.onload = function(){
	var s1, s2, s3;
	
	getHTMLSelectElement(&quot;ajaxSelect&quot;).loadByAjax();
	
	getHTMLSelectElement(&quot;ajaxSelect2&quot;).loadByAjax({
	url:&quot;data.js&quot;,
	remainInx: 0,
	sort: function(){return -1},
	complete: function(){
		getHTMLSelectElement(&quot;ajaxSelect3&quot;).loadByAjax();
	}
	});
}
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>&nbsp;motools lib的下载地址：http://motools.net 请注意版本号</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/206513#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sat, 21 Jun 2008 00:08:21 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/206513</link>
        <guid>http://cai555.javaeye.com/blog/206513</guid>
      </item>
      <item>
        <title>如何让session timeout 不显示在iframe里面</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/205774" style="color:red;">http://cai555.javaeye.com/blog/205774</a>&nbsp;
          发表时间: 2008年06月19日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><span style="color: #000000;">参考：http://www.webmasterworld.com/forum91/2831.htm</span>
</p>
<p>&nbsp;</p>
<p><code>1. if (top!= self) top.location=self.document.location; </code>
</p>
<p>&nbsp;</p>
<p>2. <span style="font-family: verdana; color: #000000; font-size: x-small;">if(top.location!= document.location)  top.location = document.location;  </span>
</p>
<p>&nbsp;</p>
<p>3. </p>
<pre><strong><strong>if (top!= self)  
 if (location) top.location.replace(self.location.href) 
 else top.document.location.replace(self.document.location.href); </strong>
</strong>
</pre>
<p>个人感觉第三种比较好</p>
<p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/205774#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 19 Jun 2008 14:18:33 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/205774</link>
        <guid>http://cai555.javaeye.com/blog/205774</guid>
      </item>
      <item>
        <title>POI实现插入一行操作，就像office excel插入一行的操作</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/202963" style="color:red;">http://cai555.javaeye.com/blog/202963</a>&nbsp;
          发表时间: 2008年06月13日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><span style="color: #000000; font-size: x-small;">注意此例需要jxls的支持</span>
<span style="color: #000000;">
</span>
<span style="color: #000000; font-size: medium;">：</span>
</p>
<pre name="code" class="java">/**
	 * insert row into the target sheet, the style of cell is the same as startRow
	 * @param wb
	 * @param sheet
	 * @param starRow - the row to start shifting
	 * @param rows
	 */
	 public static void insertRow(HSSFWorkbook wb, HSSFSheet sheet, int startRow,int rows) {
		 
		  sheet.shiftRows(startRow + 1, sheet.getLastRowNum(), rows,true,false);
		  //  Parameters:
		  //   startRow - the row to start shifting
		  //   endRow - the row to end shifting
		  //   n - the number of rows to shift
		  //   copyRowHeight - whether to copy the row height during the shift
		  //   resetOriginalRowHeight - whether to set the original row's height to the default

		  for (int i = 0; i &lt; rows; i++) {
			  
			  	HSSFRow sourceRow = null;
			  	HSSFRow targetRow = null;
			  	
			  	sourceRow = sheet.getRow(startRow);
			  	targetRow = sheet.createRow(++startRow);
			  	
			  	Util.copyRow(sheet, sourceRow, targetRow);
		  }
		  
	}</pre>
<p><span style="color: #ff0000; font-size: medium;">&nbsp;</span>
</p>
<p><span style="color: #ff0000; font-size: medium;">插入行会继承第&ldquo;startRow&rdquo;行的样式，实际上就是拷贝&ldquo;startRow&rdquo;,甚至包括合并的单元格</span>
</p>
<p>&nbsp;</p>
<p>参考了http://blog.csdn.net/daemon_boy/archive/2007/09/15/1786384.aspx的代码</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/202963#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 13 Jun 2008 14:41:44 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/202963</link>
        <guid>http://cai555.javaeye.com/blog/202963</guid>
      </item>
      <item>
        <title>POI拷贝Sheet包括每个单元格的style</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/202961" style="color:red;">http://cai555.javaeye.com/blog/202961</a>&nbsp;
          发表时间: 2008年06月13日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>注意本例需要jxls的支持</p>
<p>&nbsp;</p>
<pre name="code" class="java">/**
	 * copy all rows include styles from source sheet to target sheet
	 * @param srcSheet
	 * @param targetSheet
	 */
	public static void copySheet(HSSFSheet srcSheet, HSSFSheet targetSheet){
		Iterator it = srcSheet.rowIterator();
		while(it.hasNext()){
			HSSFRow srcRow = (HSSFRow) it.next();
			Util.copyRow(srcSheet, targetSheet, srcRow, targetSheet.createRow(srcRow.getRowNum()));
		}
	}</pre>
&nbsp;
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/202961#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 13 Jun 2008 14:37:29 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/202961</link>
        <guid>http://cai555.javaeye.com/blog/202961</guid>
      </item>
      <item>
        <title>寻找同一张表中   id   字段重复的记录 </title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/191321" style="color:red;">http://cai555.javaeye.com/blog/191321</a>&nbsp;
          发表时间: 2008年05月09日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>select &nbsp; id &nbsp; from &nbsp; tab1 &nbsp;  &nbsp; <br />
 &nbsp; group &nbsp; by &nbsp; id &nbsp; having &nbsp; count(*) &nbsp; &gt; &nbsp; 1</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/191321#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 09 May 2008 10:12:35 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/191321</link>
        <guid>http://cai555.javaeye.com/blog/191321</guid>
      </item>
      <item>
        <title>javascript &amp;&amp;后面的函数需要注意的</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/190704" style="color:red;">http://cai555.javaeye.com/blog/190704</a>&nbsp;
          发表时间: 2008年05月07日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>执行下面的代码,你会发现&amp;&amp;后面的函数不会执行：</p>
<pre name="code" class="java">function test(){alert(&quot;test&quot;); return false;}

flag = flase &amp;&amp;　test();</pre>
&nbsp;
<p>为什么呢,解释器在遇到第一个false的时候，就不再执行后面的函数了，这样可以节省运算，因为有第一个flase就表示flag一定为flase，没有必要再执行后面的函数了。</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/190704#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 07 May 2008 19:59:55 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/190704</link>
        <guid>http://cai555.javaeye.com/blog/190704</guid>
      </item>
      <item>
        <title>Firefox input 光标丢失</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/190341" style="color:red;">http://cai555.javaeye.com/blog/190341</a>&nbsp;
          发表时间: 2008年05月06日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>在用Firefox浏览页面时是否发现鼠标点击 textarea,input表单输入文本时闪烁的光标不见了,但能正常输入文本呢?<br />
你很幸运遇到了&rdquo;Firefox光标丢失&rdquo;的问题,前阵子也被这问题搞到头晕晕的,总结一下出现这问题的原因做了个简单的例子。<br />
光标丢失据我所知是Firefox的BUG,在IE系列 及Opera 等浏览器均正常! 有可能在Firefox3.0后会修复这问题,但我们现所用的都是2.0</p>
<p><a href="http://blog.gulu77.com/demo/200710/firefox_cursor_demo1.html" target="_blank"><br />
事例1:<br />
<img src="http://photo11.yupoo.com/20071024/173542_474052032_cwpuunuy.jpg" alt="Firefox光标丢失" />
<br />
</a>
<br />
<strong>以下面为例,总结了页面容器中设置了以下部分属性,均会导致Firefox光标丢失：</strong></p>
<ol>
<li>overflow:auto</li>
<li>overflow-x:auto;</li>
<li>overflow-y:auto;</li>
<li>overflow:scroll</li>
<li>overflow-x:scroll;</li>
<li>overflow-y:scroll;</li>
<li>overflow-x:hidden;</li>
<li>overflow-y:hidden;</li>
<li>position:absolute</li>
</ol>
<p>注意:上面没写到overflow:hidden; 因为overflow:hidden;可以正常使用没影响到Firefox的光标丢失</p>
<p><strong>上面例子解决的办法:</strong>
</p>
<ul>
<li>1. 避免在body设置会令光标丢失overflow:XXX属性,overflow:hidden;除外 <a href="http://blog.gulu77.com/demo/200710/firefox_cursor_demo2.html" target="_blank">参考事例2</a>
</li>
<li>2. 在position:absolute;加多个针对FF写的position:fixed; 但IE6不支持此属性,可以写成:#box { position:fixed;_position:absolute; &hellip;<a href="http://blog.gulu77.com/demo/200710/firefox_cursor_demo3.html" target="_blank">参考事例3</a>
</li>
</ul>
<p>引用自：<a href="http://blog.gulu77.com/?p=10" title="http://blog.gulu77.com/?p=10">http://blog.gulu77.com/?p=10</a>
</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/190341#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Tue, 06 May 2008 18:31:39 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/190341</link>
        <guid>http://cai555.javaeye.com/blog/190341</guid>
      </item>
      <item>
        <title>谁能告诉我为什么parseInt('09'); parseInt('08');的结果居然为零？！！</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/188863" style="color:red;">http://cai555.javaeye.com/blog/188863</a>&nbsp;
          发表时间: 2008年05月02日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>有兴趣的朋友可以执行下面这段脚本：</p>
<p>&lt;input type=&quot;button&quot; value=&quot;parseInt('05')&quot; onclick=&quot;alert(parseInt('05'))&quot;&gt;</p>
<p>&lt;input type=&quot;button&quot; value=&quot;parseInt('08')&quot; onclick=&quot;alert(parseInt('08'))&quot;&gt;</p>
<p>&lt;input type=&quot;button&quot; value=&quot;parseInt('09')&quot; onclick=&quot;alert(parseInt('09'))&quot;&gt;</p>
<p>我在IE7和FF下面试过了parseInt('05')=5，可是parseInt('08')，parseInt('09')却等于零，而且就这两个数字最特别，居然为0，百思不得其解，希望有人知道为什么。</p>
<p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/188863#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 02 May 2008 16:45:25 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/188863</link>
        <guid>http://cai555.javaeye.com/blog/188863</guid>
      </item>
      <item>
        <title>javascript获得DOM元素X,Y坐标的函数</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/188334" style="color:red;">http://cai555.javaeye.com/blog/188334</a>&nbsp;
          发表时间: 2008年04月30日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>以下是YUI用的函数：</p>
<pre name="code" class="js">isSafari = (document.childNodes &amp;&amp; !document.all &amp;&amp; !navigator.taintEnabled);
	var getXY = function(el) {
        if (document.documentElement.getBoundingClientRect) { // IE
			var box = el.getBoundingClientRect();

			var rootNode = el.ownerDocument;
			return [box.left + getDocumentScrollLeft(rootNode), box.top +
					getDocumentScrollTop(rootNode)];
        } else {
            var pos = [el.offsetLeft, el.offsetTop];
			var parentNode = el.offsetParent;

			// safari: subtract body offsets if el is abs (or any offsetParent), unless body is offsetParent
			var accountForBody = (isSafari &amp;&amp;
					el.style['position'] == 'absolute' &amp;&amp;
					el.offsetParent == el.ownerDocument.body);

			if (parentNode != el) {
				while (parentNode) {
					pos[0] += parentNode.offsetLeft;
					pos[1] += parentNode.offsetTop;
					if (!accountForBody &amp;&amp; isSafari &amp;&amp; 
							parentNode.style['position'] == 'absolute' ) { 
						accountForBody = true;
					}
					parentNode = parentNode.offsetParent;
				}
			}

			if (accountForBody) { //safari doubles in this case
				pos[0] -= el.ownerDocument.body.offsetLeft;
				pos[1] -= el.ownerDocument.body.offsetTop;
			} 
			parentNode = el.parentNode;

			// account for any scrolled ancestors
			while ( parentNode.tagName &amp;&amp; !/^body|html$/i.test(parentNode.tagName) ) 
			{
			   // work around opera inline/table scrollLeft/Top bug
			   if (parentNode.style['display'].search(/^inline|table-row.*$/i)) { 
					pos[0] -= parentNode.scrollLeft;
					pos[1] -= parentNode.scrollTop;
				}
				
				parentNode = parentNode.parentNode; 
			}

			return pos;
        }
    }

	/**
	 * Returns the left scroll value of the document 
	 * @method getDocumentScrollLeft
	 * @param {HTMLDocument} document (optional) The document to get the scroll value of
	 * @return {Int}  The amount that the document is scrolled to the left
	 */
	getDocumentScrollLeft = function(doc) {
		doc = doc || document;
		return Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
	}, 

	/**
	 * Returns the top scroll value of the document 
	 * @method getDocumentScrollTop
	 * @param {HTMLDocument} document (optional) The document to get the scroll value of
	 * @return {Int}  The amount that the document is scrolled to the top
	 */
	getDocumentScrollTop = function(doc) {
		doc = doc || document;
		return Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
	}</pre>
<p>&nbsp;下面是精简版：</p>
<pre name="code" class="js">function getX(obj){
        return obj.offsetLeft + (obj.offsetParent ? getX(obj.offsetParent) : obj.x ? obj.x : 0);
    }        
    function getY(obj){
        return (obj.offsetParent ? obj.offsetTop + getY(obj.offsetParent) : obj.y ? obj.y : 0);
    }</pre>
<p>&nbsp;不过只支持IE和FF</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/188334#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 30 Apr 2008 11:09:51 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/188334</link>
        <guid>http://cai555.javaeye.com/blog/188334</guid>
      </item>
      <item>
        <title>javascript 求div宽度时去掉px的超高效写法</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/187530" style="color:red;">http://cai555.javaeye.com/blog/187530</a>&nbsp;
          发表时间: 2008年04月28日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <pre name="code" class="js">&lt;html&gt;

&lt;head&gt;

&lt;style type=&quot;text/css&quot;&gt;

div#mydiv {

   width: 100px;

   height: 100px;

   background-color: red;

}

&lt;/style&gt;

&lt;script language=&quot;JavaScript&quot;&gt;

function addWidth() {

   var mydiv = document.getElementById(&quot;mydiv&quot;);

   alert(mydiv.style.width+&quot;,&quot;+parseInt(mydiv.style.width));

   var curr_width = parseInt(mydiv.style.width); // removes the &quot;px&quot; at the end

   mydiv.style.width = (curr_width + 10) +&quot;px&quot;;

}

&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;input type=&quot;button&quot; value=&quot;Make Bigger&quot; onclick=&quot;addWidth()&quot; /&gt;

&lt;div id=&quot;mydiv&quot; style=&quot;width:100px&quot;&gt;&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;</pre>
<p>主要是这句： var curr_width = parseInt(mydiv.style.width); // removes the &quot;px&quot; at the end</p>
<p> 是不是很有意思？</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/187530#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 28 Apr 2008 13:49:41 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/187530</link>
        <guid>http://cai555.javaeye.com/blog/187530</guid>
      </item>
      <item>
        <title>使用telnetd java类库制作守护线程</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/182020" style="color:red;">http://cai555.javaeye.com/blog/182020</a>&nbsp;
          发表时间: 2008年04月12日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>telnetdV2.0是一个纯java的telnet类库，可以作为一个telnet守护线程嵌入到自己的程序里面，可是我从<a href="http://telnetd.sourceforge.net" title="http://telnetd.sourceforge.net">http://telnetd.sourceforge.net</a>
</p>
<p>下载了一个包以后发现里面没有任何的文档，没办法，只能啃代码了，好在它还有一个例子程序<span style="color: #808080;">（在/telnetd/src/net/wimpi/telnetd/TelnetD.java里面）</span>
，main函数也超简单，其作用的是以下这个部分：</p>
<pre name="code" class="java"> } else {<br />





        myTD = TelnetD.createTelnetD(args[0]);<br />





      }<br />





      //2.start serving/accepting connections<br />





      myTD.start();</pre>
<p>&nbsp;args[0]里面存的是一个叫telnetd.properties的配置文件的url，如果你用的是本地文件，可以这样写：</p>
<p><span style="color: #0000ff;">file:///F:/telnetd/telnetd.properties&nbsp;</span>
 <span style="color: #808080;">（这个配置文件，包里面也有现成的）</span>
。</p>
<p>可能你会问我<span style="color: #ff6600;">怎么获得telnet客户端输入的数据和命令呢？</span>
别急，接下来我就告诉你怎么一回事，打开telnetd.properties 前面的东西都不用管，你要设置的是</p>
<p><span style="color: #33cccc;">##################<br />
# Shells Section #<br />
##################</span>
</p>
<p><span style="color: #33cccc;"># List of shells available and defined below<br />
<span style="color: #ff9900;">
shells=dummy,deamon</span>
<br />
<br />
# shell implementations<br />
<span style="color: #ff9900;">
shell.dummy.class=net.wimpi.telnetd.shell.DummyShell</span>
</span>
</p>
<p><span style="color: #ff9900;">shell.deamon.class=mypackage.DeamonShell</span>
</p>
<p><span style="color: #000000;">和</span>
</p>
<p><span style="color: #33cccc;">#####################<br />
# Listeners Section #<br />
#####################</span>
</p>
<p>&nbsp;</p>
<p>两部分，实际上telnetd使用了<span style="color: #ff6600;">反射工厂模式</span>
，<span style="color: #339966;">当有客户端连上一个listener的时候，实例化一个对应的shell实例</span>
，这个实例继承了net.wimpi.telnetd.shell.Shell<span style="color: #808080;">（具体看net.wimpi.telnetd.shell.DummyShell）</span>
，你所要做的就是模仿DummyShell继承net.wimpi.telnetd.shell.Shell创建自己的shell类来处理客户端的请求。</p>
<p>而listener section就是设置服务器端serversocket监听器的配置了，比如端口，telnetd支持多个端口的telnet监听，而实现这个的配置就是：</p>
<p><span style="color: #ff9900;">listeners=std</span>
</p>
<p><br />
<br />
<span style="color: #99cc00;">
# std listener specific properties<br />
<br />
#Basic listener and connection management settings</span>
<br />
<span style="color: #ff9900;">
std.port=6666<br />
std.floodprotection=5<br />
std.maxcon=25</span>
<br />
<br />
<br />
<span style="color: #99cc00;">
# Timeout Settings for connections (ms)</span>
<br />
<span style="color: #ff9900;">
std.time_to_warning=3600000<br />
std.time_to_timedout=60000</span>
<br />
<br />
<span style="color: #99cc00;">
# Housekeeping thread active every 1 secs</span>
<br />
<span style="color: #ff9900;">
std.housekeepinginterval=1000<br />
<br />
std.inputmode=character</span>
<br />
<br />
<span style="color: #99cc00;">
# Login shell</span>
<br />
<span style="color: #ff9900;">
std.loginshell=dummy</span>
<br />
<br />
<span style="color: #99cc00;">
# Connection filter class</span>
<br />
<span style="color: #ff9900;">
std.connectionfilter=none</span>
</p>
<p>如果你要同时监听两个端口，6666和7777那么你只需要这么写：</p>
<p><span style="color: #ff0000;"><span style="color: #ff9900;">listeners=</span>
std,myListener</span>
</p>
<p>std配置如上...</p>
<p><span style="color: #ff0000;">myListener.port=7777</span>
</p>
<p>以下与std类似...</p>
<p><span style="color: #99cc00;"># Login shell</span>
<br />
<span style="color: #ff0000;">
myListener.loginshell=deamon</span>
</p>
<p>...</p>
<p>现在明白了吗，要注意# Login shell这个配置，<span style="color: #ff0000;">std.loginshell=dummy</span>
而<span style="color: #ff0000;">myListener.loginshell=deamon</span>
的意思就是说：</p>
<p><span style="color: #0000ff;">如果你使用telnet客户端，连接6666端口的话，net.wimpi.telnetd.shell.DummyShell会为你服务，而如果你使用7777端口的话，mypackage.DeamonShell会来招呼你。</span>
</p>
<p>好了，我就研究到这里，反正用它足够开关我的多线程程序了，如果你还有什么不明白的，或者想要了解更多，建议可以看它的原代码。</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/182020#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sat, 12 Apr 2008 10:30:09 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/182020</link>
        <guid>http://cai555.javaeye.com/blog/182020</guid>
      </item>
      <item>
        <title>POI中读取自定义格式(日期)数据的问题</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/177297" style="color:red;">http://cai555.javaeye.com/blog/177297</a>&nbsp;
          发表时间: 2008年03月28日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>以下代码可以解决这个问题：</p><pre name="code" class="java">if(cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC 
&amp;&amp; cell.getCellStyle().getDataFormat() == 
HSSFDataFormat.getBuiltinFormat(&quot;h:mm&quot;)){
			String sDate = cell.getNumericCellValue()+&quot;&quot;;
			if(!StringUtil.isEmpty(sDate)){
				Date date = HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
				return new SimpleDateFormat(&quot;h:mm&quot;).format(date);
			}
			return &quot;&quot;;
}</pre>&nbsp;<br />其中，单元格的格式属性是custom h:mm
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/177297#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 28 Mar 2008 16:05:55 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/177297</link>
        <guid>http://cai555.javaeye.com/blog/177297</guid>
      </item>
      <item>
        <title>引用Opencms自带的树形页面</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/174119" style="color:red;">http://cai555.javaeye.com/blog/174119</a>&nbsp;
          发表时间: 2008年03月20日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>在使用move/rename功能时，点击输入框的右边的search按钮，OpenCms会弹出一个对话框让你选择move的路径，怎样在自己的页面里面调用这个弹出窗口呢？以下代码揭示了方法：</p><pre name="code" class="html">		&lt;script type=&quot;text/javascript&quot;&gt;
		function openTreeWin(treeType, includeFiles, formName, fieldName, curDoc) {
			var paramString = &quot;&quot;;
			if (treeType) {
				paramString += &quot;?type=&quot; + treeType;
			}
			if (includeFiles) {
				paramString += ((paramString == &quot;&quot;)?&quot;?&quot;:&quot;&amp;&quot;);
				paramString += &quot;includefiles=true&quot;;
			}
			var target = &quot;/system/workplace/views/explorer/tree_fs.jsp&quot; + paramString;
			if(location.pathname.indexOf(&quot;/opencms/opencms&quot;) == 0){
				target = &quot;&lt;%=request.getProtocol()%&gt;://&lt;%=request.getScheme()%&gt;:&lt;%=request.getProtocol()%&gt;/opencms/opencms&quot;+target;
			}
			treewin = openWin(target, &quot;opencms&quot;, 300, 450);
			if (treewin.opener == null){
				treewin.opener = self;
			}
			treeForm = formName;
			treeField = fieldName;
			treeDoc = curDoc;
		}
		function openWin(url, name, w, h) {
			var newwin = window.open(url, name, 'toolbar=no,location=no,directories=no,status=yes,menubar=0,scrollbars=yes,resizable=yes,top=150,left=660,width='+w+',height='+h);
			if(newwin != null) {
				if (newwin.opener == null) {
					newwin.opener = self;
				}
			}
			newwin.focus();
			return newwin;
		}
		function setFormValue(filename) {
			document.getElementById(&quot;target&quot;).value = filename;
		}
		&lt;/script&gt;
		&lt;/head&gt;
		&lt;body&gt;
		&lt;input type=&quot;text&quot; id=&quot;target&quot; name=&quot;target&quot; value=&quot;&quot;/&gt;&lt;a href=&quot;javascript:openTreeWin('copy', true);&quot; &gt;search&lt;/a&gt;
		...</pre>&nbsp;<p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/174119#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 20 Mar 2008 14:31:48 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/174119</link>
        <guid>http://cai555.javaeye.com/blog/174119</guid>
      </item>
      <item>
        <title>How to set a value in a xmlcontent resource</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/174112" style="color:red;">http://cai555.javaeye.com/blog/174112</a>&nbsp;
          发表时间: 2008年03月20日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>我引用两个老外的代码来说明问题:</p><p>如果你使用这一段代码,试图改变一个xmlcontent的内容的话，你不会成功</p><pre name="code" class="java">CmsResource document = (CmsResource) cms.getCmsObject().readResource(xmlcontentPath);

CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(cms.getCmsObject(), document, request);

xmlContent.getValue(&quot;Date&quot;, cms.getRequestContext().getLocale()).setStringValue(cms.getCmsObject(), String.valueOf(Calendar.getInstance(new java.util.Locale(&quot;es&quot;)).getTimeInMillis()));

cms.getCmsObject().writeFile(xmlContent.getFile());</pre><p>为什么？因为你必须先把修改好的xmlcontent的字节码重新写回到CmsFile对象里面去：</p><pre name="code" class="java">//you need to insert a line like this before you write the XML content:
//The reason is that the underlying file object of the XML content is not automatically updated when you modify the XML content values.

xmlContent.getFile().setContents(xmlContent.marshal());</pre><p>&nbsp;不过根据我实践的结果，光是这一点还不够，你在修改文件前，还要锁定文件：</p><pre name="code" class="java">/* lock this xmldoc, must be done before save */
			cmsobject.lockResource(fileName);</pre><p>如果还是报can not read resource的异常，八成是你的siteroot不对，这时在程序最前面加上：</p><pre name="code" class="java">/* set site root is important before read xml doc, or you can not read resource from '/' */
		cmso.getRequestContext().setSiteRoot(&quot;/&quot;);</pre><p>&nbsp;&nbsp;</p><p>老外讨论的原文：http://www.nabble.com/How-to-set-a-value-in-a-xmlcontent-resource-td13809143.html</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/174112#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 20 Mar 2008 14:22:13 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/174112</link>
        <guid>http://cai555.javaeye.com/blog/174112</guid>
      </item>
      <item>
        <title>OpenCms 参数path 与name的区别</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/173101" style="color:red;">http://cai555.javaeye.com/blog/173101</a>&nbsp;
          发表时间: 2008年03月17日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>直接调用过OpenCms api的肯定知道，org.opencms.xml.content.CmsXmlContent有两种获得value的方法：</p><p>public CmsXmlContentValueSequence getValueSequence(java.lang.String name,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java.util.Locale locale)</p><p>和</p><p>public I_CmsXmlContentValue getValue(java.lang.String path,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java.util.Locale locale)</p><p>&nbsp;</p><p>这里面path和name这连个参数有什么区别呢？假如，你有一个.xsd文件定义了，一个field叫Name那么path就是：Name[1], 而name就是Name，如果Name是一个可以人一添加的field(minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;)那么第二个Name的path=Name[2],以此类推。你可以调用org.opencms.xml.CmsXmlUtils里面的方法：public static java.lang.String createXpathElement(java.lang.String path, int index) 来生成path。 </p><p>&nbsp;</p><p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/173101#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 17 Mar 2008 17:53:18 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/173101</link>
        <guid>http://cai555.javaeye.com/blog/173101</guid>
      </item>
      <item>
        <title>OpenCms 静态导出</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/173087" style="color:red;">http://cai555.javaeye.com/blog/173087</a>&nbsp;
          发表时间: 2008年03月17日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><a href="http://japi.javaeye.com/" target="_blank">east_java</a> 兄问我static export如何操作，我给他说明一下，其实非常简单：</p><p>&nbsp;</p><p>登陆OpenCms，在最顶上的菜单里面选择：view=Administration 再选择DataBaseManagement，然后在Additional tools里面选择start static export，然后顺着wizard一步一步往下就可以了。如果遇到404问题，可以参照<span style="font-size: xx-small"><a href="../../blog/161169">OpenCms static export 404 error</a></span> 这篇文章。希望对你有帮助。</p><p>&nbsp;</p><p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/173087#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 17 Mar 2008 17:30:15 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/173087</link>
        <guid>http://cai555.javaeye.com/blog/173087</guid>
      </item>
      <item>
        <title>java.sql.SQLException: Data truncated for column '</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/171497" style="color:red;">http://cai555.javaeye.com/blog/171497</a>&nbsp;
          发表时间: 2008年03月14日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>今天遇到了一个jdbc的异常：
</p><p>java.sql.SQLException: Data truncated for column 'XXX' at row 1</p><p>在<a href="http://forums.mysql.com/read.php?39,57206,57366" target="_blank">http://forums.mysql.com/read.php?39,57206,57366</a>上面找到了原因，贴出来和大家共享，原因是column 'XXX'在数据库里面定义的是Float类型，而我在set PreparedStatement的时候,把值设成了string（st.setString(index, value)），实际上应该调用setFloat，和mysql那篇文章犯了同样的错误。 </p><p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/171497#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 14 Mar 2008 19:42:29 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/171497</link>
        <guid>http://cai555.javaeye.com/blog/171497</guid>
      </item>
      <item>
        <title>使用正则表达式从字符串中分离出数字</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/171483" style="color:red;">http://cai555.javaeye.com/blog/171483</a>&nbsp;
          发表时间: 2008年03月14日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>以下代码的作用是使用Java正则表达式从字符串：&quot;fdkaljjdklafj12345.6789afjakfdall34567.89fdsalffsafa&quot;分离出数字。</p><p>&nbsp;</p><pre name="code" class="java">Matcher   m   =   Pattern.compile(&quot;[\\d.]+&quot;).matcher(&quot;fdkaljjdklafj12345.6789afjakfdall34567.89fdsalffsafa&quot;);  
		m.find();  
		String value = m.group();
		Float lValue = Float.valueOf(value);
		System.out.println(lValue);</pre>&nbsp;如果m.find()两次，就找到第二个数字。
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/171483#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 14 Mar 2008 17:53:32 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/171483</link>
        <guid>http://cai555.javaeye.com/blog/171483</guid>
      </item>
      <item>
        <title>Eclipse plugins for firefox extension development</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/170851" style="color:red;">http://cai555.javaeye.com/blog/170851</a>&nbsp;
          发表时间: 2008年03月13日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          介绍两个用于开发firefox extension 的eclipse 插件：<br />1.XulBrooster: <a href="http://cms.xulbooster.org/" target="_blank">http://cms.xulbooster.org/</a><br /><br />2.Spket IDE: <a href="http://www.spket.com/download.html" target="_blank">http://www.spket.com/download.html</a>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/170851#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 13 Mar 2008 15:49:45 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/170851</link>
        <guid>http://cai555.javaeye.com/blog/170851</guid>
      </item>
      <item>
        <title>javascript width 语句的作用</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/170638" style="color:red;">http://cai555.javaeye.com/blog/170638</a>&nbsp;
          发表时间: 2008年03月12日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          with   语句通常用来缩短特定情形下必须写的代码量。在下面的例子中，请注意   Math   的重复使用：     <br />    <br />  x   =   Math.cos(3   *   Math.PI)   +   Math.sin(Math.LN10)     <br />  y   =   Math.tan(14   *   Math.E)   <br />  当使用   with   语句时，代码变得更短且更易读：     <br />    <br />  with   (Math){   <br />        x   =   cos(3   *   PI)   +   sin   (LN10)       <br />        y   =   tan(14   *   E)   <br />  }   <br />  <br />come from:<a href="http://topic.csdn.net/t/20060829/02/4982355.html" target="_blank">http://topic.csdn.net/t/20060829/02/4982355.html</a>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/170638#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 12 Mar 2008 20:28:42 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/170638</link>
        <guid>http://cai555.javaeye.com/blog/170638</guid>
      </item>
      <item>
        <title>OpenCms Listener 监听器的使用</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/170075" style="color:red;">http://cai555.javaeye.com/blog/170075</a>&nbsp;
          发表时间: 2008年03月11日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>如果想在OpenCms发布数据的同时do something怎么办呢？你可以使用PublishListener,publish事件监听器，OpenCms有事件的概念，有点类似javascript的listener。下面我就教你怎么写一个完整的Publish监听器。</p><p>&nbsp;</p><p>第一步：创建一个ActionClass继承org.opencms.module.I_CmsModuleAction</p><pre name="code" class="java">import org.opencms.configuration.CmsConfigurationManager;
import org.opencms.db.CmsPublishList;
import org.opencms.file.CmsObject;
import org.opencms.main.CmsEvent;
import org.opencms.main.OpenCms;
import org.opencms.module.CmsModule;
import org.opencms.module.I_CmsModuleAction;
import org.opencms.report.I_CmsReport;

public class ActionClass implements I_CmsModuleAction {

	public void initialize(CmsObject cmso, CmsConfigurationManager arg1,
			CmsModule arg2) {
		OpenCms.getPublishManager().addPublishListener(new MyPublishListener(cmso));
	}

	public void moduleUninstall(CmsModule arg0) {
		// TODO Auto-generated method stub

	}

	public void moduleUpdate(CmsModule arg0) {
		// TODO Auto-generated method stub

	}

	public void publishProject(CmsObject arg0, CmsPublishList arg1, int arg2,
			I_CmsReport arg3) {
		// TODO Auto-generated method stub

	}

	public void shutDown(CmsModule arg0) {
		// TODO Auto-generated method stub

	}

	public void cmsEvent(CmsEvent arg0) {
		// TODO Auto-generated method stub

	}

}
</pre><p>&nbsp;第二步：创建MyPublishListener继承org.opencms.publish.I_CmsPublishEventListener</p><pre name="code" class="java">import org.opencms.db.CmsPublishList;
import org.opencms.file.CmsFile;
import org.opencms.file.CmsObject;
import org.opencms.file.CmsResource;
import org.opencms.file.types.CmsResourceTypeXmlContent;
import org.opencms.jsp.CmsJspActionElement;
import org.opencms.publish.CmsPublishJobBase;
import org.opencms.publish.CmsPublishJobEnqueued;
import org.opencms.publish.CmsPublishJobFinished;
import org.opencms.publish.CmsPublishJobRunning;
import org.opencms.publish.I_CmsPublishEventListener;
import org.opencms.util.CmsUUID;
import org.opencms.xml.CmsXmlException;
import org.opencms.xml.content.CmsXmlContent;
import org.opencms.xml.content.CmsXmlContentFactory;

public class MyPublishListener implements I_CmsPublishEventListener{

	private CmsObject cmso;
	
	public MyPublishListener(CmsObject cmso){
		this.cmso = cmso;
	}
	
	public void onAbort(CmsUUID arg0, CmsPublishJobEnqueued arg1) {
		//do something on abort
	}

	public void onEnqueue(CmsPublishJobBase arg0) {
		//do something on file insert into publish queue
	}

	public void onFinish(CmsPublishJobRunning publishJob) {
		//do something on publish finished
	}

	public void onRemove(CmsPublishJobFinished arg0) {
		//do something on publish removed
	}

	public void onStart(CmsPublishJobEnqueued arg0) {
		//do something on publish start
	}

}
</pre><p>&nbsp;一般自定义代码写在onFinish方法里面，OpenCms每发布一个文件就执行一次onFinish，所以在onfinish里面获得CmsResource就是当前发布的文件。</p><p>以下是在onFinish里面获得CmsResource的代码：</p><pre name="code" class="java">CmsPublishList publishList = publishJob.getPublishList();
		List fileList = publishList.getFileList();
		Iterator it = fileList.iterator();
		while(it.hasNext()){
			CmsResource resource = (CmsResource) it.next();
}</pre><p>第三步，进入view=Administration，进入Module Manage，选择你自己的module，选择Edit Module，在ActionClass里面写入你自己的ActionClass（包名+ClassName），然后再onFinish方法里面加入一些输出代码，重启Tomcat，试着发布一个文件，看看有没有效果？</p><p>&nbsp;</p><p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/170075#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Tue, 11 Mar 2008 10:48:37 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/170075</link>
        <guid>http://cai555.javaeye.com/blog/170075</guid>
      </item>
      <item>
        <title>OpenCms export属性</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/166980" style="color:red;">http://cai555.javaeye.com/blog/166980</a>&nbsp;
          发表时间: 2008年03月03日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>if static export is disabled nothing is exported and the rules are not<br />used.</p><p>For the handeling of the link tags one standard rule is generated with<br />the url_prefix_http value. So you can still configure the servletpath.staticexport.enabled=true</p><p>the static export is controlled by the resource property export. <br />It has 6 possible values: true, false, dynamic, https, https_enabled and dynamic_https_enabled. <br />With the property staticexport.default.export you can decide whitch<br />value is used if a resource and all parentfolders don't have the the property export set.</p><p>If your site shoud be exported except a few resources you set the default to true and add the export=dynamic property to the folder where the dynamic pages are. <br />If your site is mostly dynamic you set the default to dynamic and add the export=true property to the pics and the download folder.<br />Only the values 'true' and 'dynamic' are allowed. staticexport.default.export=true the path where to save the exported pages. This path may be relative or absolute. staticexport.path=/home/httpd/html Prefix variables.<br />The export prefix defines where to find the static reources.<br />The http prefix defines the way to the dynamic resources in OpenCms. <br />The https and the servername are used only for ssl. (If you use ssl you have to<br />set the values like:<br />&nbsp;<a href="https://server.de/$%7BWEB_APP_NAME%7D/opencms">https://server.de/$%7BWEB_APP_NAME%7D/opencms</a> for the https prefix and<br />&nbsp;<a href="http://server.de/">http://server.de/</a> for the servername)<br />&nbsp;The String ${WEB_APP_NAME} will be replaced by the name of the webapplication. These variables can also be used in the rulesets.<br />&nbsp;url_prefix_export=<br />&nbsp;url_prefix_http=/${WEB_APP_NAME}/opencms<br />&nbsp;url_prefix_https=<br />&nbsp;url_prefix_servername= the name of the ruleset used to replace links while exporting, in the online project, in the offlineproject and for the name in the extern file system.<br />There are two sets of rules. Depending of the staticexport.default.export parameter the linkrules.true or the linkrules.dynamic are used.<br />linkrules.true.export=exportrules<br />linkrules.true.online=exportrules<br />linkrules.true.offline=offlinerules<br />linkrules.true.extern=externrules<br />linkrules.dynamic.export=dynamic_exportrules<br />linkrules.dynamic.online=dynamic_exportrules<br />linkrules.dynamic.offline=dynamic_offlinerules<br />linkrules.dynamic.extern=dynamic_externrules</p><p>the start rule used for extern and export (not for online and offline).<br />(the rules are regular expressions in perl5 standard) exportfirstrule=s#.([^&amp;\?]*)=([^&amp;\?]*)#_$1$2#g The start rule feature is removed. <br />Instead there is a new feature: While exporting if after the dynamic rueles nothing has changed the parameters of the link will be decoded in the name. <br />so &quot;/index.html?newsid=27&amp;size=100&quot; is replaced by &quot;/index_402.html&quot; where 402 is the id of the link in the database. Further rules (after the dynamic ones) will be processed with the new link.</p><p>The rulesets for linkreplacement as comma seperated lists You can use the ${WEB_APP_NAME} variable for the webapplication name and the four prefix variables defined above (${url_prefix_export}, {url_prefix_http},...).<br />They will be replaced befor using the regular expression.<br />In addition to this it is possible to define the place where the dynamic generated rules should be used instead of a rule use the expression *dynamicRules* (including the *'s). <br />OpenCms replaces this with the dynamic generated rules.<br />There are two types of dynamic rules. The first one is generated with the resourceproperty &quot;exportname&quot;. <br />For each resouce with this property a rule will be generated that replaces the absolute path of this resource with the value of the property. It is principally used to get nice short foldernames on the disc.<br />The second kind of dynamic rules are generated with the property &quot;export&quot;.<br />The possible values are explained below.</p><p>Possible values for the &quot;export&quot; property are:</p><p>export=true<br />&nbsp;&nbsp; The marked resource is exported.<br />&nbsp;&nbsp; For the online project, all links that point to this resource are<br />&nbsp;&nbsp; build according to the &quot;linkrules.true.extern&quot; (see above) ruleset.<br />&nbsp;&nbsp; All links found on the marked resource that have been<br />&nbsp;&nbsp; marked with the &lt;link/&gt; tag are followed and also checked for export.<br />&nbsp;&nbsp; Example:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VFS =/index.html<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RFS =${webapp_path}/opencms/export/index.html<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link=&lt;a href=&quot;${url_prefix_export}/index.html&quot;/&gt;</p><p>&nbsp;export=false<br />&nbsp;&nbsp; The marked resource is not exported.<br />&nbsp;&nbsp; For the online project, all links that point to this resource are<br />&nbsp;&nbsp; build according to the &quot;linkrules.true.online&quot; (see above) ruleset.<br />&nbsp;&nbsp; Links on the marked resource that are marked with the &lt;link/&gt; tag are<br />&nbsp;&nbsp; NOT followed and therefore not exported.<br />&nbsp;&nbsp; Example:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VFS =/index.html<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RFS =(none)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link=&lt;a href=&quot;${url_prefix_http}/index.html&quot;/&gt;</p><p>&nbsp;export=dynamic<br />&nbsp;&nbsp; The marked resource is not exported.<br />&nbsp;&nbsp; For the online project, all links that point to this resource are<br />&nbsp;&nbsp; build according to the &quot;linkrules.dynamic.online&quot; (see above) ruleset.<br />&nbsp;&nbsp; All links found on the marked resource that have been<br />&nbsp;&nbsp; marked with the &lt;link/&gt; tag are followed and also checked for export.<br />&nbsp;&nbsp; Example:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VFS =/index.html<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RFS =(none)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link=&lt;a href=&quot;${url_prefix_http}/index.html&quot;/&gt;</p><p>&nbsp;Static exort and https:<br />&nbsp;&nbsp; If you intent to use https settings with the export,<br />&nbsp;&nbsp; you must extend the ${url_prefix_http} to include the http protocol,<br />&nbsp;&nbsp; and also set the ${url_prefix_https} and the ${url_prefix_servername}.<br />&nbsp;&nbsp; In this case, all links will be absolute links that contain server name<br />&nbsp;&nbsp; and protocol (but see also the resource setting &quot;export=https_enabled&quot;<br />&nbsp;&nbsp; explained below).</p><p>&nbsp;export=https<br />&nbsp;&nbsp; The marked resource is not exported, but treated as a https resource.<br />&nbsp;&nbsp; For the online project, all links that point to this resource are<br />&nbsp;&nbsp; build according to the &quot;linkrules.true.online&quot; (see above) ruleset,<br />&nbsp;&nbsp; using the &quot;url_prefix_https&quot; Prefix.<br />&nbsp;&nbsp; All access to this resource that is NOT using the https protocol<br />&nbsp;&nbsp; is forbidden!<br />&nbsp;&nbsp; All links found on the marked resource that have been<br />&nbsp;&nbsp; marked with the &lt;link/&gt; tag are followed and also checked for export.<br />&nbsp;&nbsp; Example:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VFS =/index.html<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RFS =(none)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link=&lt;a href=&quot;${url_prefix_https}/index.html&quot;/&gt;</p><p>&nbsp;export=https_enabled<br />&nbsp;&nbsp; The marked resource is not exported.<br />&nbsp;&nbsp; For the online project, all links that point to this resource are<br />&nbsp;&nbsp; build according to the &quot;linkrules.true.extern&quot; (see above) ruleset.<br />&nbsp;&nbsp; No protocol will be used for the link, so that a browser that<br />&nbsp;&nbsp; was in https mode will be staying in https, while a http request<br />&nbsp;&nbsp; will stay in http mode.<br />&nbsp;&nbsp; Use this parameter esp. for images to prevent the dreaded webbrowser warning<br />&nbsp;&nbsp; that tells you something like &quot;The page you are about<br />&nbsp;&nbsp; to view uses secure and unsecure data&quot;.<br />&nbsp;&nbsp; All links found on the marked resource that have been<br />&nbsp;&nbsp; marked with the &lt;link/&gt; tag are followed and also checked for export.<br />&nbsp;&nbsp; Example:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VFS =/index.html<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RFS =(none)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link=&lt;a href=&quot;/${web_app_name}/${opencms_servlet_name}/index.html&quot;/&gt;</p><p>&nbsp;export=dynamic_https_enabled<br />&nbsp;&nbsp; The marked resource is not exported, but treated as a https resource.<br />&nbsp;&nbsp; This is like &quot;export=dynamic&quot; with the addition that the resource<br />&nbsp;&nbsp; will only be delivered if the request is a https request,<br />&nbsp;&nbsp; Example:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VFS =/index.html<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RFS =(none)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link=&lt;a href=&quot;${url_prefix_https}/index.html&quot;/&gt;</p><p>The dynamic rules are only for export, online and extern rules. Don't use them in the offlineruleset.<br />&nbsp;The parameterreplacement is done in the dynamic rules. So it works together with the exportname rule. <br />&nbsp;If you have a rule befor the dynamic rules that is triggered the parameterreplacement will not happen. <br />&nbsp;ruleset.offlinerules=s#^#${url_prefix_http} ruleset.exportrules=*dynamicRules*, \s#^#${url_prefix_export}# ruleset.externrules=*dynamicRules*<br />&nbsp;ruleset.dynamic_offlinerules=s#^#${url_prefix_http}#<br />&nbsp;ruleset.dynamic_exportrules=*dynamicRules*, \<br />&nbsp;s#(.*\.gif$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.jpg$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.pdf$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.css$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.doc$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.exe$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.xls$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.js$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.zip$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.jpeg$)#${url_prefix_export}$1#, \<br />&nbsp;s#(.*\.txt$)#${url_prefix_export}$1#, \<br />&nbsp;s#^#${url_prefix_http}#<br />&nbsp;ruleset.dynamic_externrules=*dynamicRules*, \<br />&nbsp;s#(.*\.gif$)#$1#, \<br />&nbsp;s#(.*\.jpg$)#$1#, \<br />&nbsp;s#(.*\.pdf$)#$1#, \<br />&nbsp;s#(.*\.css$)#$1#, \<br />&nbsp;s#(.*\.doc$)#$1#, \<br />&nbsp;s#(.*\.exe$)#$1#, \<br />&nbsp;s#(.*\.xls$)#$1#, \<br />&nbsp;s#(.*\.js$)#$1#, \<br />&nbsp;s#(.*\.zip$)#$1#, \<br />&nbsp;s#(.*\.jpeg$)#$1#, \<br />&nbsp;s#(.*\.txt$)#$1#, \<br />&nbsp;s#.*##</p><p>&nbsp;</p><p>&nbsp;When set to true the links in the static export that refer to pages in the static export will be relative instead of absolute. Enable this feature only if you use the standard ruleset.</p><p>relativelinks_in_export=true</p><p>&nbsp;</p><p>我在更新了某个页面后，使用用户凡是访问，总是发现，opencms从exports/sites里面取页面，结果页面无法更新，无奈，只能把sites/mysite的属性设置为export=false这样是可以更新了，可是以后要静态导出，不知道会不会有问题。不知道有没有更好的办法。</p>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/166980#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 03 Mar 2008 16:05:43 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/166980</link>
        <guid>http://cai555.javaeye.com/blog/166980</guid>
      </item>
      <item>
        <title>current style 获得css属性</title>
        <author>cai555</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://cai555.javaeye.com">cai555</a>&nbsp;
          链接：<a href="http://cai555.javaeye.com/blog/166395" style="color:red;">http://cai555.javaeye.com/blog/166395</a>&nbsp;
          发表时间: 2008年03月01日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          javascript 程序在第一次获得一个页面对象，比如var el = document.getElementById('div1'); 这个时候如果你取el.style.width，你可能得到的值为''值，除非你设置了el.style.width，比如el.style.width="200px";然后你再alert(el.style.width);这时才会弹出'200px'。可是css里面明明设置了这个值为什么没有值呢，原来初始值不再style.width里面，在currentstyle里面，调用以下代码，即使在第一次取style的值也是可行的（IE，FF测试通过）：<br /><pre name="code" class="java">
&lt;style type="text/css">
#test{
width: 100px;
height: 80px;
background-color: yellow;
}
&lt;/style>
&lt;body>
&lt;div id="test">This is some text&lt;/div>

&lt;script type="text/javascript">

var mydiv=document.getElementById("test")

function getCurrentStyle(obj, cssproperty, csspropertyNS){
	if(obj.style[cssproperty]){
		return obj.style[cssproperty];
	}
	if (obj.currentStyle) {// IE5+
		return obj.currentStyle[cssproperty];
	}else if (document.defaultView.getComputedStyle(obj, null)) {// FF/Mozilla
		var currentStyle = document.defaultView.getComputedStyle(obj, null);
		var value = currentStyle.getPropertyValue(csspropertyNS);
		if(!value){//try this method
			value = currentStyle[cssproperty];
		}
		return value;
	}else if (window.getComputedStyle) {// NS6+
		var currentStyle = window.getComputedStyle(obj, "");
		return currentStyle.getPropertyValue(csspropertyNS);
	}
}
alert(getCurrentStyle(mydiv, "backgroundColor", "background-color")); //alerts "yellow"
&lt;/script>
</pre>
          <br/>
          <span style="color:red;">
            <a href="http://cai555.javaeye.com/blog/166395#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sat, 01 Mar 2008 17:00:31 +0800</pubDate>
        <link>http://cai555.javaeye.com/blog/166395</link>
        <guid>http://cai555.javaeye.com/blog/166395</guid>
      </item>
  </channel>
</rss>