??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲不卡影院午夜在线观看,国产亚洲情侣一区二区无,亚洲精品无码高潮喷水A片软http://www.tkk7.com/swingboat/category/6380.html&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;----只要路选对了,׃怕有多远Q?/description>zh-cnTue, 17 Jul 2007 19:29:49 GMTTue, 17 Jul 2007 19:29:49 GMT60利用JGroups同步两台server之间的cache?/title><link>http://www.tkk7.com/swingboat/archive/2007/07/16/130565.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Mon, 16 Jul 2007 06:21:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2007/07/16/130565.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/130565.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2007/07/16/130565.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/130565.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/130565.html</trackback:ping><description><![CDATA[     摘要: 一、需求前D|间做了一个项目,在后台有很多的数据都攑օCcache中了Q而且q会对cache中的数据q行更新。如果只有一台server没有M问题Q但是如果考虑到集负载^衡,q接多个server的时候,有问题出现了,怎么h能保证多个server之间cache的同步呢Q请看下面的部v图?二、引入JGroupsJGroups是一个可靠的l间通讯工具Q进E可以加入一个通讯l,l组内所有的成员...  <a href='http://www.tkk7.com/swingboat/archive/2007/07/16/130565.html'>阅读全文</a><img src ="http://www.tkk7.com/swingboat/aggbug/130565.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2007-07-16 14:21 <a href="http://www.tkk7.com/swingboat/archive/2007/07/16/130565.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>有关?”和“_”的search?/title><link>http://www.tkk7.com/swingboat/archive/2007/05/24/119848.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Thu, 24 May 2007 15:28:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2007/05/24/119848.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/119848.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2007/05/24/119848.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/119848.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/119848.html</trackback:ping><description><![CDATA[        今天下午QAl我报了一个bugQ说输入“f+f”或?#8220;f_f”能够搜烦?#8220;f f”的结果。看着qbug的描qͼ心里q想着怎么会呢Q模p查询也不会出现q样的结果啊Q赶紧自p?#8220;f+f”?#8220;f_f”验证下,l果两次都输Z“f f”。由于查询的条g是通过URL后的参数输入的,当我输入“f+f”Ӟ发现参数传入到服务端后变成了“f f”了,如果是这P那search的结果是正确的。但Z么输入的参数“f+f”怎么会变成了“f f”呢?而且在输入参数都通过escapeq行~码了。于是上|google了一下,发现escape函数是不会对“+”q行~码的,但请求时Qweb服务器会qo?#8220;+”q个字符。所以我们必L工对“+”q行~码Q把所有的“+”都改变ؓ“%2b”。修改代码测试,再次输入“f+f”Q结果不能搜索出“f f”的结果了?br>而对输入“f_f”搜烦?#8220;f f”的结果,主要原因是这个是模糊查询的一U?#8220;f_f”表示搜烦出含有两?#8220;f”字符而且中间有一个字W分隔的Q?#8220;f  f”正好满q个条gQ于是被搜烦Z?br> <img src ="http://www.tkk7.com/swingboat/aggbug/119848.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2007-05-24 23:28 <a href="http://www.tkk7.com/swingboat/archive/2007/05/24/119848.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>synchronized的作?/title><link>http://www.tkk7.com/swingboat/archive/2007/05/08/115882.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Tue, 08 May 2007 03:02:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2007/05/08/115882.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/115882.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2007/05/08/115882.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/115882.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/115882.html</trackback:ping><description><![CDATA[     摘要: synchronized的作?nbsp;一、同步方法public synchronized void methodAAA(){ //…. }锁定的是调用q个同步Ҏ的对?试Qa、不使用q个关键字修饰方法,两个U程调用同一个对象的q个Ҏ。目标类Q?1public class TestThread {2   &nb...  <a href='http://www.tkk7.com/swingboat/archive/2007/05/08/115882.html'>阅读全文</a><img src ="http://www.tkk7.com/swingboat/aggbug/115882.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2007-05-08 11:02 <a href="http://www.tkk7.com/swingboat/archive/2007/05/08/115882.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>不同时区之间Q时间的转换Q?/title><link>http://www.tkk7.com/swingboat/archive/2007/04/20/112236.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Fri, 20 Apr 2007 08:24:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2007/04/20/112236.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/112236.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2007/04/20/112236.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/112236.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/112236.html</trackback:ping><description><![CDATA[一、问题描q?br>   当Y仉要国际化的时候,我们不得不考虑旉的问题。不同的地方有不同的时区Q从而显C的旉是不一L。而且很多国家在某一D|间还可能会实行夏令时Q显C的旉又不一栗ؓ了保证时间的正确性,必须有统一的基U,从而不得不考虑下列旉之间的{换?br>   a、long timeToUTC(time,timezone)                //把给定的旉Ҏl定的时{化ؓUTC<br>   b、String UTCToTime(long,timezone)              //把给定的UTC转化为制定时区的旉<br>   c、timeToTime(time,timezone1,timezone2)         //把给定的旉Ҏ制定的时{化ؓ另指定时区的旉<br>   //考虑到数据的存储Q还必须考虑数据库对于时间字D늚格式?br><br>二、解x?br>   昄旉的不同,主要原因的是时区不同。如果不考虑自定义时区的问题QJODA包就能很好解决上面的问题Q但是如果考虑自定义时区(很多软g׃考虑夏oӞ从而增加了自定义时区的功能来设|夏令时Q,则我们必自己来写{换函数?br>   a、JODA<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> timeToUTC(String theSourceTime, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> sourceWbxTZID)<br></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img id=Codehighlighter1_88_559_Open_Image onclick="this.style.display='none'; Codehighlighter1_88_559_Open_Text.style.display='none'; Codehighlighter1_88_559_Closed_Image.style.display='inline'; Codehighlighter1_88_559_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_88_559_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_88_559_Closed_Text.style.display='none'; Codehighlighter1_88_559_Open_Image.style.display='inline'; Codehighlighter1_88_559_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedBlock.gif" align=top>        </span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception </span><span id=Codehighlighter1_88_559_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_88_559_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        DateTime targDate;        <br></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img id=Codehighlighter1_160_338_Open_Image onclick="this.style.display='none'; Codehighlighter1_160_338_Open_Text.style.display='none'; Codehighlighter1_160_338_Closed_Image.style.display='inline'; Codehighlighter1_160_338_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_160_338_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_160_338_Closed_Text.style.display='none'; Codehighlighter1_160_338_Open_Image.style.display='inline'; Codehighlighter1_160_338_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (sourceWbxTZID </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)) </span><span id=Codehighlighter1_160_338_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_160_338_Open_Text><span style="COLOR: #000000">{  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">UTC<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">mdyFormatter:org.joda.time.format.DateTimeFormatter</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">            targDate </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> mdyFormatter.withZone(DateTimeZone.UTC).parseDateTime(theSourceTime);</span><span style="COLOR: #008000">//<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #008000"><img id=Codehighlighter1_345_516_Open_Image onclick="this.style.display='none'; Codehighlighter1_345_516_Open_Text.style.display='none'; Codehighlighter1_345_516_Closed_Image.style.display='inline'; Codehighlighter1_345_516_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_345_516_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_345_516_Closed_Text.style.display='none'; Codehighlighter1_345_516_Open_Image.style.display='inline'; Codehighlighter1_345_516_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span style="COLOR: #000000">        }</span></span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> </span><span id=Codehighlighter1_345_516_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_345_516_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>            targDate </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> mdyFormatter.withZone(<br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>                DateTimeZone.forID(convertTimezone(sourceWbxTZID)))<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>                .parseDateTime(theSourceTime);<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> targDate.getMillis();<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000">   <br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align=top>    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> String UTCToTime(</span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> theUTCTime, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> targetWbxTZID)<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img id=Codehighlighter1_653_1012_Open_Image onclick="this.style.display='none'; Codehighlighter1_653_1012_Open_Text.style.display='none'; Codehighlighter1_653_1012_Closed_Image.style.display='inline'; Codehighlighter1_653_1012_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_653_1012_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_653_1012_Closed_Text.style.display='none'; Codehighlighter1_653_1012_Open_Image.style.display='inline'; Codehighlighter1_653_1012_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedBlock.gif" align=top>        </span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception </span><span id=Codehighlighter1_653_1012_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_653_1012_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        DateTime theSourceTime </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> DateTime(theUTCTime);<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img id=Codehighlighter1_749_840_Open_Image onclick="this.style.display='none'; Codehighlighter1_749_840_Open_Text.style.display='none'; Codehighlighter1_749_840_Closed_Image.style.display='inline'; Codehighlighter1_749_840_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_749_840_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_749_840_Closed_Text.style.display='none'; Codehighlighter1_749_840_Open_Image.style.display='inline'; Codehighlighter1_749_840_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (targetWbxTZID </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)) </span><span id=Codehighlighter1_749_840_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_749_840_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> mdyFormatter.withZone(DateTimeZone.UTC).print(theSourceTime);<br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img id=Codehighlighter1_847_1006_Open_Image onclick="this.style.display='none'; Codehighlighter1_847_1006_Open_Text.style.display='none'; Codehighlighter1_847_1006_Closed_Image.style.display='inline'; Codehighlighter1_847_1006_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_847_1006_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_847_1006_Closed_Text.style.display='none'; Codehighlighter1_847_1006_Open_Image.style.display='inline'; Codehighlighter1_847_1006_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        }</span></span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> </span><span id=Codehighlighter1_847_1006_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_847_1006_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> mdyFormatter.withZone(<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>                DateTimeZone.forID(convertTimezone(targetWbxTZID))).print(<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>                theSourceTime);<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>    }</span></span></div> <br>   b、自~写<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img id=Codehighlighter1_0_109_Open_Image onclick="this.style.display='none'; Codehighlighter1_0_109_Open_Text.style.display='none'; Codehighlighter1_0_109_Closed_Image.style.display='inline'; Codehighlighter1_0_109_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_0_109_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_0_109_Closed_Text.style.display='none'; Codehighlighter1_0_109_Open_Image.style.display='inline'; Codehighlighter1_0_109_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedBlock.gif" align=top><span id=Codehighlighter1_0_109_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/** */</span><span id=Codehighlighter1_0_109_Open_Text><span style="COLOR: #008000">/**</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>   *sourceDateQ需要{换的日期Q此日期必须是居于GMT的时间?br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>   *timezoneQ?br></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>   *gMTQ是否是GMT旉<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>   *isConsiderDayLightQ是否考虑夏o?br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>   </span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img id=Codehighlighter1_228_568_Open_Image onclick="this.style.display='none'; Codehighlighter1_228_568_Open_Text.style.display='none'; Codehighlighter1_228_568_Closed_Image.style.display='inline'; Codehighlighter1_228_568_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_228_568_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_228_568_Closed_Text.style.display='none'; Codehighlighter1_228_568_Open_Image.style.display='inline'; Codehighlighter1_228_568_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedBlock.gif" align=top>  </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> convert(Date sourceDate, Timezone timezone, </span><span style="COLOR: #0000ff">boolean</span><span style="COLOR: #000000"> gMT, </span><span style="COLOR: #0000ff">boolean</span><span style="COLOR: #000000"> isConsiderDayLight) </span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception </span><span id=Codehighlighter1_228_568_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_228_568_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> gMTOffSet </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">) timezone.getGmtOffset();</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">获取偏移?/span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> sourceTime </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sourceDate.getTime();<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img id=Codehighlighter1_345_408_Open_Image onclick="this.style.display='none'; Codehighlighter1_345_408_Open_Text.style.display='none'; Codehighlighter1_345_408_Closed_Image.style.display='inline'; Codehighlighter1_345_408_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_345_408_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_345_408_Closed_Text.style.display='none'; Codehighlighter1_345_408_Open_Image.style.display='inline'; Codehighlighter1_345_408_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (gMT) </span><span id=Codehighlighter1_345_408_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_345_408_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        targetTime </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sourceTime </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> gMTOffSet </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">60</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img id=Codehighlighter1_415_510_Open_Image onclick="this.style.display='none'; Codehighlighter1_415_510_Open_Text.style.display='none'; Codehighlighter1_415_510_Closed_Image.style.display='inline'; Codehighlighter1_415_510_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_415_510_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_415_510_Closed_Text.style.display='none'; Codehighlighter1_415_510_Open_Image.style.display='inline'; Codehighlighter1_415_510_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    }</span></span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> </span><span id=Codehighlighter1_415_510_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_415_510_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        targetTime </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sourceTime </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> ( </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> gMTOffSet </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">60</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">北京偏移8个小Ӟ如是Q?8*60*1000</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">14</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></span><span style="COLOR: #000000">    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">下面是考虑夏o?/span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">16</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">    <img src="http://www.tkk7.com/Images/dot.gif"><img src="http://www.tkk7.com/Images/dot.gif"><br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> targetTime;<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>    <br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>  }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align=top>  </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> timeToUTC(String theSourceTime, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> sourceWbxTZID)<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img id=Codehighlighter1_660_1006_Open_Image onclick="this.style.display='none'; Codehighlighter1_660_1006_Open_Text.style.display='none'; Codehighlighter1_660_1006_Closed_Image.style.display='inline'; Codehighlighter1_660_1006_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_660_1006_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_660_1006_Closed_Text.style.display='none'; Codehighlighter1_660_1006_Open_Image.style.display='inline'; Codehighlighter1_660_1006_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedBlock.gif" align=top>        </span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception </span><span id=Codehighlighter1_660_1006_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_660_1006_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        SimpleDateFormat sdf </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SimpleDateFormat(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">MM/dd/yyyy HH:mm:ss</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);        <br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        sdf.setTimeZone(TimeZone.getTimeZone(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">GMT</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        Date date</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">sdf.parse(theSourceTime);                <br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        Timezone timezone</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(Timezone)keyedByWbxTZID.get(String.valueOf(sourceWbxTZID));</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">此函C要是获取Timezone相关的数?/span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">26</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> convert(date,timezone,</span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);        <br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>  }</span></span><span style="COLOR: #000000"> <br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align=top>  </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> String UTCToTime(</span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> theUTCTime, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> targetWbxTZID)<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img id=Codehighlighter1_1096_1501_Open_Image onclick="this.style.display='none'; Codehighlighter1_1096_1501_Open_Text.style.display='none'; Codehighlighter1_1096_1501_Closed_Image.style.display='inline'; Codehighlighter1_1096_1501_Closed_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_1096_1501_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1096_1501_Closed_Text.style.display='none'; Codehighlighter1_1096_1501_Open_Image.style.display='inline'; Codehighlighter1_1096_1501_Open_Text.style.display='inline';" src="http://www.tkk7.com/Images/OutliningIndicators/ContractedBlock.gif" align=top>        </span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception </span><span id=Codehighlighter1_1096_1501_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/Images/dot.gif"></span><span id=Codehighlighter1_1096_1501_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        Date date</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Date();<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        date.setTime(theUTCTime);<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        Timezone timezone</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(Timezone)keyedByWbxTZID.get(String.valueOf(targetWbxTZID));</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">此函C要是获取Timezone相关的数?/span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">33</span><span style="COLOR: #008000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> time</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">convert(date,timezone,</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">); <br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        SimpleDateFormat sdf </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SimpleDateFormat(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">MM/dd/yyyy HH:mm:ss</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">); <br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        sdf.setTimeZone(TimeZone.getTimeZone(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">GMT</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> sdf.format(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Date(time));<br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.tkk7.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>  }</span></span></div> <p><br>三、相关的一些时间概?nbsp; <br>GMT:是格林威治标准旉的英文羃写,格林威治是u敦泰晤士沛_岸的一个地方,׃?9世纪开始,因ؓ世界各国来往频繁Q而欧z大陆、美z大陆和亚洲大陆都有各自的时区,所以ؓ免؜乱,各国的代表就?884 q在国华盛召开了国际大会,通过协议选出伦敦的格林威治,作ؓ全球旉的中心点Q格林威L准时间因而诞生。所以有GMT功能的腕表就是说腕表拥有其中的小时表盘可以显CGMT旉?/p> <p>UTC:短L传送很q,可能l过许多国家、许多不同时区,所以需要有一l时间作标准Q?q个标准旉Co-ordinated Universal Time ~写UTC 或称 UT。过ȝ为格林威L_GMTQ,虽然有些地方有冬令时间或夏o旉Q但UTC旉是不会改的,大家都以它ؓ标准?/p> <p>DST:Daylight saving time .(夏oӞ各个国家开始和l束旉的计方法是不一L)<br>国Q加拿大夏o时v止时_每年3月䆾W二个星期天?1月䆾W一个星期天Q亚利桑那州、夏威夷、L多黎各、维京岛和美属萨摩亚除外Q?/p> <p>德国、意大利{多数欧z国家夏令时h旉Q每q?月䆾最后一个星期天?0月䆾最后一个星期天?/p> <p><br>MST:Mountain Standard Time<br>PST:Pacific Standard Time<br>EST:Eastern Standard Time</p> <p>很多朋友对于剧官方|站上的旉表达方式不是很理解?br>q里说明一下,以Prison BreakZQMonday 8/7c<br>它指的是Q星期一 东部旉8?中部旉7炏V两地同时播放,不过因ؓ时差问题Q钟表上昄的时间有一个小时的差别?br>管官网的播放时间对于美国以外的朋友来说意义不大Q不q如果你愿意查出相对应的北京旉Q可以?a >http://www.worldtimeserver.com</a> 的服务,我相信国内也有很多类似的旉转换|站Q包括googleQ百度都可以Q这里就不再|嗦了。至目前来_东旉和北京时间相?2时Q也是_我们比美东快12个小时。Prison Break的播放时间就是北京时间第二天的早?点,也就是星期二 8:00AM.</p> <p>相对于美国,我们国家的时区划分相对简单很多,特别是取消夏令时后,不出国,我们基本上不用考虑时差问题?/p> <p>国本土大陆地区采用的时东向西ؓQ?br>东岸标准时区 (Eastern Standard Time; EST; UTC-5; R?Q包括大西洋沿岸各州、墨西哥湑֏密西西比河以东地区?<br>中部标准时区 (Central Standard Time; CST; UTC-6; S?Q包括密西西比河沿岸以及以西州䆾的大部䆾?<br>山部标准时区 (Mountain Standard Time; MST; UTC-7; T?, 沿大陆分水岭—洛矶山一U的州䆾、大盆地及科|拉多河l?<br>太^z标准时?(Pacific Standard Time; PST; UTC-8; U?Q包括太qx沿岸地区及内华达州?/p> <p>国本土大陆地区以外地区采用的时?br>阿拉斯加标准时区 (Alaska Standard Time; AKST; UTC-9; V? 包括阿拉斯加州大部䆾地区?<br>夏威夷—阿留申时区 (Hawaii-Aleutian Standard TimeQ非正式Q夏威夷标准?Hawaii Standard Time; HST; UTC-10; W?Q包括夏威夷州及169°30'W以西的阿留申岛?</p> <p>国属土采用的时?br>大西z标准时?(Atlantic Standard Time; AST, UTC-4; Q? 包括波多黎各及美属处奛_?<br>萨摩亚时?(Samoa Standard Time; UTC-11, X?包括属萨摩亚?<br>查莫|时?(Chamorro Standard Time; UTC+10, Zone K)包括兛_及北马里亚纳岛?/p> <p>中国的时区:我们使用北京旉Q以前称中原标准旉Q现在台湾依然用这个名Uͼ是中国大陆、香港、澳門和台湄标准旉。在时区划分上,属东八区Q比世界协调时早8时Q记为UTC+8?/p> <p>严格地讲Q北京时间ƈ不是北京Q东l?16°Q地方的旉Q而是东经120°度地方的地方旉。而北京时间也不是在北京确定的Q而是׃于中国版囑և何中心位|陕西潼的中国U学院国家授时中心的9台铯原子钟和2台氢原子钟组通过_֯比对和计实玎ͼq过卫星与世界各国授旉门进行实时比寏V?/p> <p>清光l?8q_公元1902q_Q中国vx制定岸Ӟ以东l?20度之时刻为标准。公?912q_位于北京的中央观象台全国分Z个时区,民国28q??日中华民国内攉K召集标准旉会议Q确?912q划分之时区Z华民国标准时区。分别ؓ:<br>1昆仑时区 UTC+5.5 新疆襉K与部分西?br>2新藏时区 UTC+6 新疆及西?br>3陇蜀时区 UTC+7 中国中部<br>4中原标准时区 UTC+8 中国岸<br>5长白时区 UTC+9 中国东北<br>1949q之后,中国大陆?#8220;中原标准旉”改称“北京旉”Qƈ在全国统一使用该时间作为标准时间。台湑ֈl持“中原标准旉”之名Uͼ也有U?#8220;台北旉”?#8220;国家标准旉”?/p> <p>׃中国大陆全境都采用北京时间作为标准时Q因此在中国襉K的陕ѝ甘肃、新疆等省和自治区造成了生zM便,比如在乌鲁木齐,北京旉比当地时间提前两个小Ӟ北京旉??0分(中国大陆公务机关通行的上班时_相当于当地时间早??0分。作x施,一些新疆地区居民用乌鲁木齐时_即东六区QUTC+6Q时间?/p> <p>2005q_一些中华h民共和国全国人民代表大会代表提出中国大陆时区加以细分的Q提议分Z北京旉为基的东部时_UTC+8Q、以陕西地区旉为基的中部时_UTC+7Q和以新疆、西藏地区时间ؓ基础的西部时_UTC+6Q。后又将该提议改为分Z个时区,即UTC+8和UTC+7两个时区Q陕ѝ四川、重庆、贵州、云南及以西各省采用UTC+7的西部时间。但该提案尚未ʎ诸表冟?br><br></p> <img src ="http://www.tkk7.com/swingboat/aggbug/112236.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2007-04-20 16:24 <a href="http://www.tkk7.com/swingboat/archive/2007/04/20/112236.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>maven2使用问题?命o?!http://www.tkk7.com/swingboat/archive/2006/11/13/80448.htmlswingboatswingboatMon, 13 Nov 2006 07:30:00 GMThttp://www.tkk7.com/swingboat/archive/2006/11/13/80448.htmlhttp://www.tkk7.com/swingboat/comments/80448.htmlhttp://www.tkk7.com/swingboat/archive/2006/11/13/80448.html#Feedback1http://www.tkk7.com/swingboat/comments/commentRss/80448.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/80448.html
  • 昄一个插件所有的goal
  • 创徏一个基于模版的目Qeclipse目
     //创徏标准目录模板
     mvn archetype:create -DgroupId=com.codeline.commons -DartifactId=codelineCommons 
    //创徏web目
     mvn archetype:create -DgroupId=com.mycompany.app    -DartifactId=my-webapp       -DarchetypeArtifactId=maven-archetype-web
  • 查看一个插件所用的版本
    mvn -Dplugin=groupId:artifactId help:describe
  • 忽略~译test
    mvn -Dmaven.test.skip=true
  • 一个jar文gQ它是maven的一个插Ӟ怎么安装到本地库?br />   mvn install:install-file
           -Dfile=<path-to-file>
        -DgroupId=<group-id>
        -DartifactId=<artifact-id>
        -Dversion=<version>
        -Dpackaging=<packaging>
        -DgeneratePom=true
  • maven的生命周?br />    validateQ验证工E是否正,所有需要的资源是否可用?
        compileQ编译项目的源代码?
        test-compileQ编译项目测试代码?
        testQ用已~译的测试代码,试已编译的源代码?
        packageQ已发布的格式,如jarQ将已编译的源代码打包?
        integration-testQ在集成试可以q行的环境中处理和发布包?
        verifyQ运行Q何检查,验证包是否有效且辑ֈ质量标准?
        installQ把包安装在本地的repository中,可以被其他工E作Z赖来使用
       deployQ在整合或者发布环境下执行Q将最l版本的包拷贝到q程的repositoryQ得其他的开发者或者工E可以共享? 
       generate-sourcesQ生应用需要的M额外的源代码Q如xdoclet?
  • Dependency Scope
     compileQ缺省|适用于所有阶D,会随着目一起发布?
     providedQ类似compileQ期望JDK、容器或使用者会提供q个依赖。如servlet.jar?
     runtimeQ只在运行时使用Q如JDBC驱动Q适用q行和测试阶Dc?
     testQ只在测试时使用Q用于编译和q行试代码。不会随目发布?
     systemQ类似providedQ需要显式提供包含依赖的jarQMaven不会在Repository中查扑֮
     egQ?br /> <dependency>
        <groupId>hibernate</groupId>
        <artifactId>hibernate</artifactId>
        <version>3.0.3</version>
        <scope>test</scope>
     </dependency>


  • swingboat 2006-11-13 15:30 发表评论
    ]]>
    同步QsynchronizedQ对E序性能的媄响!http://www.tkk7.com/swingboat/archive/2006/11/10/80363.htmlswingboatswingboatFri, 10 Nov 2006 04:37:00 GMThttp://www.tkk7.com/swingboat/archive/2006/11/10/80363.htmlhttp://www.tkk7.com/swingboat/comments/80363.htmlhttp://www.tkk7.com/swingboat/archive/2006/11/10/80363.html#Feedback2http://www.tkk7.com/swingboat/comments/commentRss/80363.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/80363.html
            int curIndex = 0;
            AuditQueueEntry aqe;
            
    synchronized (localCriticalSection) {      
                
    while (curIndex < theList.size()) {
                    aqe 
    = (AuditQueueEntry) theList.get(curIndex);
                    
    if (aqe.getTrailId() == theTrailId) {
                        theList.remove(curIndex);
                    }
     else {
                        curIndex
    ++;
                    }

                }

            }

    localCriticalSection做ؓ一个信号量来控制程序对cL员变量theList的访问,从而保证了theList在同一旉只有一个程序访问。运行程序,q个函数p了将q?U钟。同步是很耗时间的?br />在java.util.Collections中提供了很多Ҏ来保证集合(数组Q的同步讉K?br />我们修改cL员变量theList的实例化ҎQ?br />
    theList = Collections.synchronizedList(new LinkedList());

    再修改处理函敎ͼ
            int curIndex = 0;
            AuditQueueEntry aqe;
    //        synchronized (localCriticalSection) {
            synchronized(theList) {    
                
    while (curIndex < theList.size()) {
                    aqe 
    = (AuditQueueEntry) theList.get(curIndex);
                    
    if (aqe.getTrailId() == theTrailId) {
                        theList.remove(curIndex);
                    }
     else {
                        curIndex
    ++;
                    }

                }

            }

    再运行,q个函数才花费将q一U钟的时_
    在Collections中提供了很多q类的方法?img src ="http://www.tkk7.com/swingboat/aggbug/80363.html" width = "1" height = "1" />

    swingboat 2006-11-10 12:37 发表评论
    ]]>
    Tomcat5.5.x的JNDI配置Qjakarta-tomcat-5.5.7Q?/title><link>http://www.tkk7.com/swingboat/archive/2006/10/25/77134.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Wed, 25 Oct 2006 02:09:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2006/10/25/77134.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/77134.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2006/10/25/77134.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/77134.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/77134.html</trackback:ping><description><![CDATA[ <p> </p> <hr /> jakarta-tomcat-5.5.7<br />1.web.xml的设|?br /><resource-ref><br />  <description>OPDB JNDI for TOMCAT</description><br />  <res-ref-name>jdbc/opdb</res-ref-name><br />  <res-type>javax.sql.DataSource</res-type><br />  <res-auth>Container</res-auth><br /> </resource-ref><p>2.cof/server.xml的配|?egQC:\jakarta-tomcat-5.5.7\conf)?/p><p><Resource name="jdbc/opdb" auth="Steve" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@172.16.208.190:1522:opdb" username="test" password="oracle" maxActive="20" maxIdle="10" maxWait="10000"/> </p><p>3.web/META-INF/content.xml的配|?/p><p><?xml version='1.0' encoding='utf-8'?><br /><Context><br /> <!-- note: the following resource name is set up to use the inet jdbc driver.  If you are<br />  using a different driver, then you will have to change the driverClassName.<br />  You will have to change the url (the ip and db identifier part), username and password <br />  entries for your environment.<br />  --><br /> <Resource name="jdbc/opdb" auth="Container" type="javax.sql.DataSource" username="test" password="oracle"<br />  driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@172.16.208.190:1522:opdb" maxActive="20" maxIdle="10"<br />  maxWait="-1" validationQuery="SELECT 1 FROM DUAL"/><br /></Context><br />说明Q我的tomcat版本?.5.7。好像必配|content.xml文gQ但是配了这个文Ӟserver.xml中的讄不v作用了。下面是各参数的说明Q?br />driveClassNameQJDBC驱动cȝ完整的名Uͼ <br />maxActiveQ同时能够从q接池中被分配的可用实例的最大数Q?<br />maxIdleQ可以同旉|在q接池中的连接的最大数Q?<br />maxWaitQ最大超时时_以毫U计Q?<br />passwordQ用户密码; <br />urlQ到JDBC的URLq接Q?<br />userQ用户名Uͼ <br />validationQueryQ用来查询池中空闲的q接?br /></p><img src ="http://www.tkk7.com/swingboat/aggbug/77134.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2006-10-25 10:09 <a href="http://www.tkk7.com/swingboat/archive/2006/10/25/77134.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AXIS学习Q?Q?/title><link>http://www.tkk7.com/swingboat/archive/2006/02/13/30477.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Mon, 13 Feb 2006 09:11:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2006/02/13/30477.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/30477.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2006/02/13/30477.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/30477.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/30477.html</trackback:ping><description><![CDATA[<P>1.axis服务器包的校验?BR>  ?A >http://ws.apache.org/</A>下蝲axis后,解压Q拷贝axis到tomcat的webapps目录下。启动tomcatQ运?A href="http://localhost:8080/axis">http://localhost:8080/axis</A><BR>  点击“validation”,E序会检少的包Qƈ提示下蝲路径。我目前包含的包如下Q?BR>    axis.jar;                               <BR> axis-ant.jar;                           <BR> axis-schema.jar;                        <BR> commons-discovery-0.2.jar;              <BR> commons-httpclient-3.0-rc2.jar;         <BR> commons-logging-1.0.4.jar;              <BR> jaxrpc.jar;                             <BR> log4j-1.2.8.jar;                        <BR> saaj.jar;                               <BR> wsdl4j-1.5.1.jar;                       <BR> activation.jar;                         <BR> mail.jar     <BR><BR>2.环境变量的配|?BR>  其实q行axis是不用配|环境变量的。但有的时候需要利用axis提供的一些工P产生一些文Ӟ需要应用很多包Q利用ClassPath比较方便了?BR>  AXIS_HOME:<BR>  AXIS_LIB:<BR>  AXISCLASSPATH: <BR> <BR>3.把axis集成 到项目中<BR>  a、把上面所提到的包拯到项目相应的lib目录?BR>  b、修改web.xml文gQ增加所需的servlet配置<BR>  <servlet><BR>  <servlet-name>AxisServlet</servlet-name><BR>  <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class><BR> </servlet></P> <P> <servlet><BR>  <servlet-name>AdminServlet</servlet-name><BR>  <servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class><BR>  <load-on-startup>100</load-on-startup><BR> </servlet></P> <P> <servlet><BR>  <servlet-name>SOAPMonitorService</servlet-name><BR>  <servlet-class>org.apache.axis.monitor.SOAPMonitorService</servlet-class><BR>  <init-param><BR>   <param-name>SOAPMonitorPort</param-name><BR>   <param-value>5001</param-value><BR>  </init-param><BR>  <load-on-startup>100</load-on-startup><BR> </servlet></P> <P> <servlet-mapping><BR>  <servlet-name>AxisServlet</servlet-name><BR>  <url-pattern>/servlet/AxisServlet</url-pattern><BR> </servlet-mapping></P> <P> <servlet-mapping><BR>  <servlet-name>AxisServlet</servlet-name><BR>  <url-pattern>*.jws</url-pattern><BR> </servlet-mapping></P> <P> <servlet-mapping><BR>  <servlet-name>AxisServlet</servlet-name><BR>  <url-pattern>/services/*</url-pattern><BR> </servlet-mapping></P> <P> <servlet-mapping><BR>  <servlet-name>SOAPMonitorService</servlet-name><BR>  <url-pattern>/SOAPMonitor</url-pattern><BR> </servlet-mapping></P> <P> <session-config><BR>  <session-timeout>5</session-timeout><BR> </session-config></P> <P> <mime-mapping><BR>  <extension>wsdl</extension><BR>  <mime-type>text/xml</mime-type><BR> </mime-mapping></P> <P> <mime-mapping><BR>  <extension>xsd</extension><BR>  <mime-type>text/xml</mime-type><BR> </mime-mapping><BR>   <BR>4.服务发布Qjws文g发布和定制发布)<BR>  a、jws文g发布<BR>  在web应用E序目录下,新徏一个jws文gQ例如:Hello.jws文gQ其实就是个java文gQ不包含包名Q?nbsp; <BR>  public class Hello {<BR> public String hello(String name){<BR>  if(name==null){<BR>   name="";<BR>  }<BR>  return "Hi,你好 "+name+",Ƣ迎来到Web服务世界Q?;<BR> }<BR>  }<BR>  q样可以直接查看hello服务相应的wsdl了:<A href="http://localhost:8080/testaxis/hello.jws?wsdl">http://localhost:8080/testaxis/hello.jws?wsdl</A><BR>  <BR>  b.定制发布?BR>  定制发布Q依赖一个server-confif.wsdd文g?BR>  在web-inf目录下新Z个deploy.wsdd文gQ设|发布的服务Q例如:<BR>  <deployment xmlns="<A <BR>            xmlns:java="<A ><BR>    <service name="city" provider="java:RPC"><BR>      <parameter name="className" value="yhp.test.axis.service.CityService"/><BR>      <parameter name="allowedMethods" value="*"/><BR>    </service><BR>  </deployment><BR>  <BR>  利用axis提供的工P可以生成server-confif.wsdd文g了:<BR>  java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient deploy.wsdd<BR>  在运行过E中发现Q如果没有把axis自带的应用发布到服务器上Q运行时会提C?04的错?未发现axis/servlet/AxisServlet?/P> <P>5.客户端调?BR>        String endpoint = "<A href="http://localhost">http://localhost</A>:" + "8080"<BR>    + "/testaxis/services/city";  //以定制发布方式,如果是jws文gQ则endpoint为相应的jws文g</P> <P>  Service service = new Service();<BR>  Call call = (Call) service.createCall();<BR>  call.setTargetEndpointAddress(new java.net.URL(endpoint));<BR>  call.setOperationName("getZip");</P> <P>  String res = (String) call.invoke(new Object[] {""});//object数组E方法的参数 </P> <P>  System.out.println(res);<BR>  <BR>6.生成客户端stub相关c?BR>   Axis提供了工L成客Lstub相关的类Q即通过wsdl产生stub?BR>   java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java <A href="http://localhost:8080/testaxis/services/city?wsdl">http://localhost:8080/testaxis/services/city?wsdl</A> <BR>  <BR>     </P><img src ="http://www.tkk7.com/swingboat/aggbug/30477.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2006-02-13 17:11 <a href="http://www.tkk7.com/swingboat/archive/2006/02/13/30477.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>获取classes目录下的资源文g和类所在目录下的资源文Ӟhttp://www.tkk7.com/swingboat/archive/2006/02/07/29778.htmlswingboatswingboatTue, 07 Feb 2006 03:54:00 GMThttp://www.tkk7.com/swingboat/archive/2006/02/07/29778.htmlhttp://www.tkk7.com/swingboat/comments/29778.htmlhttp://www.tkk7.com/swingboat/archive/2006/02/07/29778.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/29778.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/29778.htmlDBUtil.class所在目录:DBUtil.class.getResourceAsStream("testing.properties")Q?BR>
      Properties props = new Properties();
      props.load(DBUtil.class.getClassLoader().getResourceAsStream("testing.properties"));
      strDriver = props.getProperty("Driver"); 
      strURL = props.getProperty("URL");
      strUser = props.getProperty("User");
      strPassword = props.getProperty("Password");
      System.out.println("strDriver="+strDriver);
      System.out.println("strURL="+strURL);
      System.out.println("strUser="+strUser);
      System.out.println("strPassword="+strPassword); 

    swingboat 2006-02-07 11:54 发表评论
    ]]>
    实现ccloneҎ http://www.tkk7.com/swingboat/archive/2005/12/28/25666.htmlswingboatswingboatWed, 28 Dec 2005 01:22:00 GMThttp://www.tkk7.com/swingboat/archive/2005/12/28/25666.htmlhttp://www.tkk7.com/swingboat/comments/25666.htmlhttp://www.tkk7.com/swingboat/archive/2005/12/28/25666.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/25666.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/25666.html例子Q?
    public class Outbound2splitVO implements Serializable ,Cloneable {
        private long id;
        private String brand;
        public long getId() {
            return id;
        }
        public void setId(long id){
            this.id=id;
        }
        public void setBrand(String brand) {
            this.brand=brand;
        }
        public String getBrand(){
            return brand;
        }

        public Object clone(){
              Outbound2splitVO o = null;
              try{
                  o = (Outbound2splitVO)super.clone();
              }catch(CloneNotSupportedException e){
                  e.printStackTrace();
              }
              return o;
          }
    }

    cdd现Cloneable接口QcloneҎ?/P>

    swingboat 2005-12-28 09:22 发表评论
    ]]>
    forward,include,redirect区别?/title><link>http://www.tkk7.com/swingboat/archive/2005/12/28/25663.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Wed, 28 Dec 2005 01:21:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2005/12/28/25663.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/25663.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2005/12/28/25663.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/25663.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/25663.html</trackback:ping><description><![CDATA[<div id="mmig2qe" class=postText>forward,include,redirect是jsp中web面(jsp或servelt)的三U不同的路由关系Q三个貌似相同,其实q是有许多差别的Q而了解这些细微的差别Q在web开发中是很重要的?<BR>说明Q?<BR>一、forward、include由javax.servlet.RequestDispatcher来封?由包容器container提供RequestDispatcher接口的实玎ͼ其中声明如下Q?<BR>void forward(ServletRequest req,ServletResponse res) <BR>void include(ServeltRequest req,ServletResponse res) <BR>可以通过两种方式得到RequestDispatcher: <BR>1、ServletContext.getRequestDispatcher(String path); <BR>其中q里的path必须开始ؓ"/"Q即q里的path必须相对于context的root. <BR>2、ServeltRequest.getRequestDispatcher(String path) <BR>q里的path可以为相对\?如果path开始ؓ"/",则也认ؓ是从context的root开始的?<BR>二、Redirect由HttpServletResponse.sendRedirect(String location)来支?<BR>差别Q?<BR>三个都可以对用户的requestq行转发Q但是还是有许多的不同,差别最主要集中在如下几个方面: <BR>1、forward与include׃Request范围内的对象,而redirect则不行,卻I如果一个javabean被声明ؓrequest范围的话Q则被forward到的资源也可以访问这个javabean,而redriect则不行?<BR>2、forward与include基本上都是{发到context内部的资源,而redirect可以重定向到外部的资?如: req.sendRedriect("http://www.mocuai.com"); <BR><BR>Forward功能的实玎ͼq样 <BR>private void setForward(String url,ServletRequest request, ServletResponse response)throws Exception {   <BR>        HttpServletRequest hreq = (HttpServletRequest) request; <BR>        RequestDispatcher dispatcher =  hreq.getSession().getServletContext().getRequestDispatcher(url); <BR>        dispatcher.forward(request,response); <BR>} </DIV><img src ="http://www.tkk7.com/swingboat/aggbug/25663.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2005-12-28 09:21 <a href="http://www.tkk7.com/swingboat/archive/2005/12/28/25663.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CollectionQMapQHashMapQhashTableQTreeMapQListQVectorQArrayList的区?http://www.tkk7.com/swingboat/archive/2005/12/28/25664.htmlswingboatswingboatWed, 28 Dec 2005 01:21:00 GMThttp://www.tkk7.com/swingboat/archive/2005/12/28/25664.htmlhttp://www.tkk7.com/swingboat/comments/25664.htmlhttp://www.tkk7.com/swingboat/archive/2005/12/28/25664.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/25664.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/25664.htmlCollection接口Q包含list和set子接?
    Collection和Map接口之间的主要区别在于:Collection中存储了一l对象,而Map存储关键?值对?
    在Map对象中,每一个关键字最多有一个关联的倹{?
    Map:不能包括两个相同的键Q一个键最多能l定一个倹{null可以作ؓ键,q样的键只有一个;可以有一个或多个键所对应?
    gؓnull。当get()Ҏq回null值时Q即可以表示Map中没有该键,也可以表C键所对应的gؓnull。因此,在Map中不能由get()Ҏ来判断Map中是否存在某个键Q而应该用containsKey()Ҏ来判断?
    l承Map的类有:HashMapQHashTable
    HashMapQMap的实现类Q缺省情况下是非同步的,可以通过Map Collections.synchronizedMap(Map m)来达到线E同?
    HashTableQDictionary的子c,省是线E同步的。不允许关键字或gؓnull

    当元素的序很重要时选用TreeMapQ当元素不必以特定的序q行存储Ӟ使用HashMap。Hashtable的用不被推荐,因ؓHashMap提供了所有类似的功能Qƈ且速度更快。当你需要在多线E环境下使用ӞHashMap也可以{换ؓ同步的?


    以下引用Q?
    • Z么要使用集合c?/STRONG>

    当你事先不知道要存放数据的个敎ͼ或者你需要一U比数组下标存取机制更灵zȝҎӞ你就需要用到集合类?/P>

    • 理解集合c?/STRONG>

    集合cd放于java.util包中?
    集合cd攄都是对象的引用,而非对象本nQ出于表达上的便利,我们U集合中的对象就是指集合中对象的引用Qreference)?
    集合cd主要?U:set(集)、list(列表Q和map(映射)?

    (1)?
    集(setQ是最单的一U集合,它的对象不按特定方式排序Q只是简单的把对象加入集合中Q就像往口袋里放东西?
    寚w中成员的讉K和操作是通过集中对象的引用进行的Q所以集中不能有重复对象?
    集也有多U变体,可以实现排序{功能,如TreeSetQ它把对象添加到集中的操作将变ؓ按照某种比较规则其插入到有序的对象序列中。它实现的是SortedSet接口Q也是加入了对象比较的Ҏ。通过寚w中的对象q代Q我们可以得C个升序的对象集合?

    (2)列表
    列表的主要特征是其对象以U性方式存储,没有特定序Q只有一个开头和一个结,当然Q它与根本没有顺序的集是不同的?
    列表在数据结构中分别表现为:数组和向量、链表、堆栈、队列?
    关于实现列表的集合类Q是我们日常工作中经常用到的Q将在后边的W记详细介绍?

    (3)映射
    映射与集或列表有明显区别Q映中每个w是成对的。映中存储的每个对象都有一个相关的关键字(KeyQ对象,关键字决定了对象在映中的存储位|,索对象时必须提供相应的关键字Q就像在字典中查单词一栗关键字应该是唯一的?
    关键字本wƈ不能军_对象的存储位|,它需要对q一U散?hashing)技术来处理Q生一个被UC散列?hash code)的整数|散列码通常用作一个偏|量Q该偏置量是相对于分配给映射的内存区域v始位|的Q由此确定关键字/对象对的存储位置。理x况下Q散列处理应该生给定范围内均匀分布的|而且每个关键字应得到不同的散列码?

    • 集合cȝ?/STRONG>

    java.util中共?3个类可用于管理集合对象,它们支持集、列表或映射{集合,以下是这些类的简单介l?/P>

    集:
    HashSetQ?/STRONG> 使用HashMap的一个集的实现。虽焉定义成无序,但必d在某U方法能相当高效地找C个对象。用一个HashMap对象实现集的存储和检索操作是在固定时间内实现?
    TreeSetQ?/STRONG> 在集中以升序对对象排序的集的实现。这意味着从一个TreeSet对象获得W一个P代器按升序提供对象。TreeSetcM用了一个TreeMap.
    列表Q?/STRONG>
    VectorQ?/STRONG> 实现一个类似数l一L表,自动增加定w来容U你所需的元素。用下标存储和索对象就象在一个标准的数组中一栗你也可以用一个P代器从一个Vector中检索对象。Vector是唯一的同步容器类??当两个或多个U程同时讉K时也是性能良好的?
    Stsck: q个cMVectorz而来Qƈ且增加了Ҏ实现??一U后q先出的存储l构?
    LinkedList: 实现一个链表。由q个cd义的链表也可以像栈或队列一栯使用?
    ArrayList: 实现一个数l,它的规模可变q且能像链表一栯讉K。它提供的功能类似VectorcM不同步?
    映射Q?
    HashTableQ?/STRONG> 实现一个映象,所有的键必非I。ؓ了能高效的工作,定义键的cdd现hashcode()Ҏ和equal()Ҏ。这个类是前面java实现的一个承,q且通常能在实现映象的其他类中更好的使用?
    HashMapQ?/STRONG> 实现一个映象,允许存储I对象,而且允许键是I(׃键必L唯一的,当然只能有一个)?
    WeakHashMapQ?/STRONG> 实现q样一个映象:通常如果一个键对一个对象而言不再被引用,?对象对将被舍弃。这与HashMap形成对照Q映象中的键l持?对象对的生命周期Q尽用映象的E序不再有对键的引用Qƈ且因此不能检索对象?
    TreeMapQ?/STRONG> 实现q样一个映象,对象是按键升序排列的?

    下图是集合类所实现的接口之间的关系Q?

    Set和List都是由公共接口Collection扩展而来Q所以它们都可以使用一个类型ؓCollection的变量来引用。这意味着M列表或集构成的集合都可以用这U方式引用,只有映射c除外(但也不是完全排除在外Q因为可以从映射获得一个列表。)所以说Q把一个列表或集传递给Ҏ的标准途径是用Collectioncd的参数?/P>



    swingboat 2005-12-28 09:21 发表评论
    ]]>
    面q虑器制?http://www.tkk7.com/swingboat/archive/2005/12/28/25660.htmlswingboatswingboatWed, 28 Dec 2005 01:20:00 GMThttp://www.tkk7.com/swingboat/archive/2005/12/28/25660.htmlhttp://www.tkk7.com/swingboat/comments/25660.htmlhttp://www.tkk7.com/swingboat/archive/2005/12/28/25660.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/25660.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/25660.html
    需求描qͼ
            在网站中有一些网|受保护的Q即只有规定的用h能访问,而有一些网Q何h都可以访问。所以用户在IE中输入URL提交后,服务器必d用户输入的URLq行分析q虑?/DIV>
    分析Q?/DIV>
           需要考虑的问题:
    1?怎么拦截用户输入的URLQ?/DIV>
    2?怎么判断输入的URL是否是受保护的?
    3?在用户量很大的情况下Q每一个URL都要q行判断Q怎样提高判断的性能Q?/DIV>
    ҎQ?/DIV>
    1?在web.xml中可以定义filter,服务器会更据filter的定义进行拦截,以及相应的处理。例如下面的配置Q?/DIV>
    <filter>  
               <filter-name>webfilter</filter-name>
               <filter-class>com.cyberway.web.filter.WebFilter</filter-class>
           </filter>
           <filter-mapping>
               <filter-name>webfilter</filter-name>
               <url-pattern>/*</url-pattern>
       </filter-mapping>
     
    filter-name:定义qo器的名称
    filter-classQ定义过滤器处理的类
    url-patternQ定义拦截url
    /*:表示所有的都拦?/DIV>
    *.jsp:只拦截jsp文g
    2、利用数据库把需要保护的URL保存hQ每h一ơ,一ơ?/DIV>
    3、如果每h一ơ,都去数据库访问检一ơ,q样性能一定会非常差的。网站稳定以后受保护的页面一般更新较,我们可以W一ơ请求时Q从数据库中获取所有的受保护页面,保存在hashtble中,然后每次从hashtable中进行检。如果更C受保护页面,则需更新hashtable。其实就是一Ucatch模式。事例代码如下:
    public class URLHelper?/DIV>
    private static URLHelper meQ?/DIV>
    private HashTable  urlTable;
    private Boolean hasInitQfalseQ?/DIV>
     
    static?/DIV>
          me=new URLHelper();
    ?/DIV>
    private URLHelper(){
    }
    public URLHelper getInstance(){
          return me;
    }
    public Boolean isHasInit{
          return hasInit;
    }
    public void init(){
          urlTable=new HashTable();
          Collection datas=getAllURLs();
          Iterator it=datas.iterator();
          while(it.hasNext()){
                 URLVO vo=(URLVO)it.next();  //URLVO:一个记录URL信息的实体类
                 urlTable.put(vo.URL,vo);
    }
    }
    //ҎURL判断是否上受保护?/DIV>
    public boolean isProtected(String url) {
        return urlTable.containsKey(url);
    }
    private Collection getAllURLs(){
          //从数据库中获取所受保护网?
    }
    ?/DIV>
    WebFiltercd下:
    public class WebFilter extends HttpServlet implements Filter {
     
        public void doFilter(ServletRequest request, ServletResponse response,
                     FilterChain filterChain) throws ServletException {
            try {
                request.setCharacterEncoding("GBK");
               HttpServletRequest hreq = (HttpServletRequest) request;
                HttpServletResponse hres = (HttpServletResponse) response;
                HttpSession session = hreq.getSession();
                ServletContext context = session.getServletContext();
                String currentURL = hreq.getRequestURI();//q回不带参数URL
                /String preURL = hreq.getHeader("referer");//q回上一URL
                String urlParam = hreq.getQueryString();//q回当前URL的参?/DIV>
                String currentURLpara = null;
                // check if is requesting a protect resource
                if (currentURL != null) {
                     //String contextPath = hreq.getContextPath();//q回 "/webroot"
    URLHelper helper=URLHelper.getInstance();
    if(helper. isProtected(currentURL)){
        setForwardQcurrentURLQ?
    }else?/DIV>
        setForwardQ”error.jsp”);    
    ?nbsp;                 
                    ?/DIV>
                    filterChain.doFilter(request, response);
            }catch (ServletException sx) {
                filterConfig.getServletContext().log(sx.getMessage());
            }catch (IOException iox) {
                filterConfig.getServletContext().log(iox.getMessage());
            }catch (Exception ex) {
                filterConfig.getServletContext().log(ex.getMessage());
            }
    ?/DIV>
    //forward一个页?/DIV>
    private void setForward(String url, ServletRequest request,
                        ServletResponse response) throws Exception {
                 HttpServletRequest hreq = (HttpServletRequest) request;
                 RequestDispatcher dispatcher =            hreq.getSession().getServletContext()
                              .getRequestDispatcher(url);
                 dispatcher.forward(request, response);
          }
    ?/DIV>
     
     
      
     
            
     
     


    swingboat 2005-12-28 09:20 发表评论
    ]]>含有中文字符串的截取问题Q?/title><link>http://www.tkk7.com/swingboat/archive/2005/12/28/25656.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Wed, 28 Dec 2005 01:18:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2005/12/28/25656.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/25656.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2005/12/28/25656.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/25656.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/25656.html</trackback:ping><description><![CDATA[<div id="susocqq" class=postText>问题Q?BR>    字符Ԍmusic<<丽的草原我的家>>。该字符串的长度即str.length()为:17Q而目前需要存入数据库对应的字D长度ؓQ?6。所以必d字符串进行截取。而前16个字节中Q“原”字只有半个。这样存入数据库对会出现“?”。所以必d断是否是半个汉字Q即只能存入“music<<丽的草”?BR><BR>分析Q?BR>    汉字是双字节~码Q它Z能够与英文字W分开Q每个字节的最高位一定ؓ1。如果是汉字Q那么这个字节就是小?的。这个函数就是通过q一原理实现的。所以要通过getBytes()转化为byte型,再比较与零的大小? <BR>getBytes()是把一个字W串转成一个byte数组Q因机的数据都是基于字W的Q也是说一个字W串实际上就是一个字W流Q因此可以{为字W数l?BR><BR>E序Q?BR>    public  static  String  getStr(String  src,  int  len)  {  <BR>       if  (src  ==  null)              return  null;  <BR>       if  (src.getBytes().length  <=  len)    return  src;  <BR> <BR>       byte[]  s  =  src.getBytes();  <BR>       int  flag  =  0;  <BR>       for(int  i=0;i<len;++i){  <BR>         if(s[i]  <  0)  flag++;    <BR>       }  <BR>       if(flag%2!=0)  len--;          <BR> <BR>       byte[]  d  =  new  byte[len];  <BR>       System.arraycopy(s,  0,  d,  0,  len);  <BR>       return  new  String(d);  <BR>   }  <BR></DIV><img src ="http://www.tkk7.com/swingboat/aggbug/25656.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2005-12-28 09:18 <a href="http://www.tkk7.com/swingboat/archive/2005/12/28/25656.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在struts1.1框架下,利用smartupload实现文g的上传(可以是多个文Ӟ http://www.tkk7.com/swingboat/archive/2005/12/28/25657.htmlswingboatswingboatWed, 28 Dec 2005 01:18:00 GMThttp://www.tkk7.com/swingboat/archive/2005/12/28/25657.htmlhttp://www.tkk7.com/swingboat/comments/25657.htmlhttp://www.tkk7.com/swingboat/archive/2005/12/28/25657.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/25657.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/25657.html1、前端页面upload.jspQ后台处理程序UplodAction.java
    2、struts.config的配|参数如下(没有讄ActionFormQ:
    <action input="/upload.jsp"  path="/save" scope="request" type="yhp.test.web.UploadAction" validate="false">
          <forward name="success" path="/list.do" />
        </action>
    3、upload.jsp面中主要部分代?BR><%@ page contentType="text/html; charset=GBK"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <html:html>
    <head>
    <title> 试Struts利用SmartUpload上传文g </title>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    </head>
    <body>
    <html:form action="/save.do" styleId="formItem" method="post"  enctype="multipart/form-data">
    <html:hidden property="id"/>
    <html:file property="serverpath" styleClass="input-text"></html:file>
    </html:form>
    </body>
    </html:html>
    4、UploadAction.java
    import com.jspsmart.upload.File;
    import com.jspsmart.upload.Files;
    import com.jspsmart.upload.SmartUpload;

    public ActionForward doBatchsave(ActionMapping actionMapping,
       ActionForm actionForm, HttpServletRequest httpServletRequest,
       HttpServletResponse httpServletResponse) throws Exception {
    SmartUpload mySmartUpload = new SmartUpload();
      mySmartUpload.initialize(getServlet().getServletConfig(),httpServletRequest, httpServletResponse);  
      mySmartUpload.upload();
      //获取除文件以外的相关信息Q例如upload.jsp中隐藏控件id的?BR>  String strId=(String)mySmartUpload.getRequest().getParameter("id");
      Files files=mySmartUpload.getFiles();
      Collection col=files.getCollection();
      Iterator it=col.iterator();
      while(it.hasNext()){
        File file=(File)it.next();    
        String oldFileName=file.getFileName();     
        String extname=file.getFileExt();
        String fileName=Sequence.getSequence()+"."+extname;//产生一个唯一的文件名
        file.saveAs("c:\\temp\"+fileName);    
      }
      return (actionMapping.findForward("success"));
    ?


    swingboat 2005-12-28 09:18 发表评论
    ]]>在java中一U中文问题的解决办法 http://www.tkk7.com/swingboat/archive/2005/12/28/25658.htmlswingboatswingboatWed, 28 Dec 2005 01:18:00 GMThttp://www.tkk7.com/swingboat/archive/2005/12/28/25658.htmlhttp://www.tkk7.com/swingboat/comments/25658.htmlhttp://www.tkk7.com/swingboat/archive/2005/12/28/25658.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/25658.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/25658.html例如Q?BR><script>
       location.href="goto.jsp?type=分类";
    </script>
    在goto.jsp面要获取type参数Q需要对此参数进行处理:
    String type=(String)request.getParameter("type");
    type=type==null?"":type.trim();
    type=new String(type.getBytes("ISO-8859-1"),"GBK");

    System.out.println("Type:"+type);//q样才能正确输出QType:分类


    swingboat 2005-12-28 09:18 发表评论
    ]]>
    在struts框架下实现文件的上传 http://www.tkk7.com/swingboat/archive/2005/12/28/25654.htmlswingboatswingboatWed, 28 Dec 2005 01:16:00 GMThttp://www.tkk7.com/swingboat/archive/2005/12/28/25654.htmlhttp://www.tkk7.com/swingboat/comments/25654.htmlhttp://www.tkk7.com/swingboat/archive/2005/12/28/25654.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/25654.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/25654.html

    ׃jspsmartupload上传文gQ当前端面没有file控gӞ后端用jspsmartupload控gupload时将会走入一个死循环。现在采用struts自己提供的功能实现文件的上传?BR>1、前端页面upload.jsp
    <html:form action="/filesave.do" styleId="formItem" method="post"  enctype="multipart/form-data">
    <INPUT  class='input-file' type="file" name="theFile">
    </html:form>
    2、struts-config.xml文g配置
    <form-bean name="UploadForm" type="yhp.test.web.UploadForm" />
    <action input="/upload.jsp" name="UploadForm"   path="/filesave" scope="request" type="yhp.test.web.UploadAction" validate="false">
          <forward name="success" path="/success.jsp" />
          <forward name="error" path="/error.jsp" />
        </action>
    3、UploadForm.java文g
    package yhp.test.web;

    import org.apache.struts.upload.FormFile;
    import org.apache.struts.action.ActionForm;

    public class UploadForm extends ActionForm {
      protected String theText;   //使用protected ,其它需要上传的form可以l承此form
      protected boolean writeFile = true;
      protected FormFile theFile;
      protected String filePath;

      public String getTheText() {
        return theText;
      }
      public void setTheText(String theText) {
        this.theText = theText;
      }
      public FormFile getTheFile() {
        return theFile;
      }
      public void setTheFile(FormFile theFile) {
        this.theFile = theFile;
      }
      public void setWriteFile(boolean writeFile) {
        this.writeFile = writeFile;
      }
      public boolean getWriteFile() {
        return writeFile;
      }
      public void setFilePath(String filePath) {
        this.filePath = filePath;
      }
      public String getFilePath() {
        return filePath;
      }
      public void reset() {
        writeFile = false;
      }
    }

    4、UploadAction.java文g
    package yhp.test.web;

    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Date;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.upload.FormFile;


    public class UploadAction extends Action {
      public ActionForward execute(ActionMapping actionMapping,
                                   ActionForm actionForm,
                                   HttpServletRequest httpServletRequest,
                                   HttpServletResponse httpServletResponse) throws
          Exception {
        if (actionForm instanceof UploadForm) {
          // 获取上传的目?BR>      String path = getServlet().getServletContext().getInitParameter("UPLOADPATH");
          File f = new File(path);
          if (!f.isDirectory()) {
            f.mkdir();
          }

          UploadForm theForm = (UploadForm) actionForm;
          String text = theForm.getTheText();
          FormFile file = theForm.getTheFile();
          String fileName = file.getFileName();
          String contentType = file.getContentType();
          boolean writeFile = theForm.getWriteFile();
          String desFileName=path fileName ;
          String size = (file.getFileSize() + " bytes");
          try {
              InputStream stream = file.getInputStream();
       OutputStream bos = new FileOutputStream(strFileName);         
              byte[] buffer = new byte[file.getFileSize()];
              stream.read(buffer);
              bos.write(buffer);
       stream.close(); 
              bos.close();
              return actionMapping.findForward("success");
          }
          catch (FileNotFoundException fnfe) {
              return actionMapping.findForward("success");
          }
          catch (IOException ioe) {
              return actionMapping.findForward("success");
          }
          catch(Exception eo){
              return actionMapping.findForward("error");
          } 
        }else{
          return actionMapping.findForward("error");
        }
      }
    }



    swingboat 2005-12-28 09:16 发表评论
    ]]>struts及jstl使用问题?一) http://www.tkk7.com/swingboat/archive/2005/12/28/25653.htmlswingboatswingboatWed, 28 Dec 2005 01:15:00 GMThttp://www.tkk7.com/swingboat/archive/2005/12/28/25653.htmlhttp://www.tkk7.com/swingboat/comments/25653.htmlhttp://www.tkk7.com/swingboat/archive/2005/12/28/25653.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/25653.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/25653.html1、ActionForm中的属性必d<html:form></html:form>块中输出
    struts-config.xml文g配置Q?BR>  <form-beans>
        <form-bean name="TestForm" type="yhp.test.struts.TestForm" />
      </form-beans>
    <action-mappings>
        <action input="/test/teststruts.jsp" name="TestForm" path="/test/teststruts" scope="request" type="yhp.test.struts.TestAction" validate="false">
          <forward name="success" path="/test/teststruts.jsp" />
        </action> 
    </action-mappings>
    TestForm.java文gQ两个属性)Q?BR>package yhp.test.struts;
    import org.apache.struts.action.*;
    public class TestForm extends ActionForm{
        private String message;
        private String data;
        public String getData() {
            return data;
        }
        public void setData(String data) {
            this.data = data;
        }
        public String getMessage() {
            return message;
        }
        public void setMessage(String message) {
            this.message = message;
        }
    }
    TestAction.java文gQ?BR>public ActionForward execute(ActionMapping actionMapping,
                ActionForm actionForm, HttpServletRequest httpServletRequest,
                HttpServletResponse httpServletResponse) throws Exception {
            if(actionForm instanceof TestForm){
             TestForm form=(TestForm)actionForm;
             form.setMessage("Test Struts!");
             form.setData("Return data is YHP");
            }
            return actionMapping.findForward("success");       
        }
    teststruts.jsp文gQ?BR><%@ page contentType="text/html; charset=GBK" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%
    String contextPath = request.getContextPath();
    response.setLocale(java.util.Locale.CHINA);
    %>
    <html>
     <head>
     </head> 
    <body>
    <html:form action="/test/teststruts.do" styleId="formItem" method="post">
       <html:text  property="message"/><br>
       <html:text  property="data"/><br>
    </html:form>
    </body>
    </html>
    说明Q没有红色部分代码,后台会报出Cannot find bean org.apache.struts.taglib.html.BEAN in any scope的错误信息。这栯明struts中ActionForm的数据是Zhtml中对应form的数据?BR>2、不利用struts标签输出ActionForm的属性?BR><%@ page import="yhp.test.struts.TestForm"%>
    <%
    TestForm form=(TestForm)request.getAttribute("TestForm");//ActionFormcd
    %>
    <html>
     <head>
     </head> 
    <body>
    <html:form action="/test/teststruts.do" styleId="formItem" method="post">
       <html:text  property="message"/><br>
       <html:text  property="data"/><br>
     <%=form.getMessage()%><br>
    </html:form>
    </body>
    </html>
    3、通过JSTL输出ActionForm中的属性?BR>利用JSTL输出AcitonForm中的属性|<c:out value="${TestForm.data}" /><br>
    利用JSTL输出AcitonForm中的属性|<c:out value="${requestScope.TestForm.data}" /><br> 
    U色的字是ActionFormcdQ两句的l果是一L
    说明Qstruts把ActionForm写入了requestScope中,cd作ؓrequestScope的名字?BR>卻IhttpServletRequest.setAttribute("TestForm",actionForm);
    <c:out value="${requestScope.TestForm.data}" />  也就是输Z个bean的属性倹{?/SPAN>



    swingboat 2005-12-28 09:15 发表评论
    ]]>
    junit的?/title><link>http://www.tkk7.com/swingboat/archive/2005/12/28/25651.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Wed, 28 Dec 2005 01:14:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2005/12/28/25651.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/25651.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2005/12/28/25651.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/25651.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/25651.html</trackback:ping><description><![CDATA[<div id="c4gqwgm" class=postText> <P>背景Q当我们写完一个类的时候,需要对cȝ某些Ҏq行试。我以前的做法是在类的main函数中,new一个类的实例,然后调用cȝҎq行试。当需要测试的Ҏ来较多的时候,main函数也在逐渐的变大,最后连自己都糊涂了<IMG height=20 src="http://www.cnblogs.com/Emoticons/QQ/10.gif" width=20 border=0>。这时候就需要junit了?BR>~码原则Q?BR>        从技术上强制你先考虑一个类的功能,也就是这个类提供l外部的接口Q而不至于太早陷入它的l节。这是面向对象提倡的一U设计原则?BR>如果你要写一D代码:<BR>1. 先用 junit 写测试,然后再写代码<BR>2. 写完代码Q运行测试,试p|<BR>3. 修改代码Q运行测试,直到试成功 <BR>~写步骤Q如下图<BR><IMG src="http://www.cnblogs.com/images/cnblogs_com/swingboat/step.jpg" border=0><BR>试代码Q?BR>package yhp.test.junit;</P> <P>import junit.framework.*;<BR>public class TestCar extends TestCase {<BR>    protected int expectedWheels;<BR>    protected Car myCar;<BR>    public TestCar(String name) {<BR>        super(name);<BR>    }<BR>    protected void setUp(){  //q行初始化Q?BR>        expectedWheels = 4;<BR>        myCar = new Car();<BR>    }<BR>    public static Test suite()    {//JUnit的TestRunner会调用suiteҎ来确定有多少个测试可以执?BR>        return new TestSuite(TestCar.class);<BR>    }<BR>    public void testGetWheels(){//以test开_注意命名<BR>        assertEquals(expectedWheels, myCar.getWheels());<BR>    }<BR>}<BR><BR>以下是通过eclipse自带的junit工具产生的代码:<BR>package yhp.test.junit;<BR>import junit.framework.TestCase;<BR>public class TestCar2 extends TestCase {<BR>    protected int expectedWheels;<BR>    protected Car myCar;<BR>    public static void main(String[] args) {<BR>        junit.textui.TestRunner.run(TestCar2.class);//TestCar是个Ҏsuite的静态方?BR>    }<BR>    protected void setUp() throws Exception {<BR>        super.setUp();<BR>        expectedWheels = 4;<BR>        myCar = new Car();<BR>    }<BR>    protected void tearDown() throws Exception {<BR>        super.tearDown();<BR>    }<BR>    public TestCar2(String arg0) {<BR>        super(arg0);<BR>    }<BR>    public final void testGetWheels() {<BR>        assertEquals(expectedWheels, myCar.getWheels());<BR>    }<BR>}<BR><BR>当有多个试cȝ时候,pȝ能进行统一试Q这时可以利用TestSuite来实现。可以将TestSuite看作是包Ҏ试的一个容器?BR>通过eclipse自带的工L成的代码如下Q?BR>package yhp.test.junit;<BR>import junit.framework.Test;<BR>import junit.framework.TestSuite;</P> <P>public class AllTests {<BR>     public static Test suite() {<BR>        TestSuite suite = new TestSuite("Test for yhp.test.junit");<BR>        //$JUnit-BEGIN$<BR>        suite.addTest(TestCar.suite());         //调用的方法,参数不一P实际是一致的?BR>        suite.addTestSuite(TestCar2.class);  //<BR>        //$JUnit-END$<BR>        return suite;<BR>    }<BR>}</P></DIV><img src ="http://www.tkk7.com/swingboat/aggbug/25651.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2005-12-28 09:14 <a href="http://www.tkk7.com/swingboat/archive/2005/12/28/25651.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsp面Q以excel的方式输?http://www.tkk7.com/swingboat/archive/2005/12/28/25649.htmlswingboatswingboatWed, 28 Dec 2005 01:13:00 GMThttp://www.tkk7.com/swingboat/archive/2005/12/28/25649.htmlhttp://www.tkk7.com/swingboat/comments/25649.htmlhttp://www.tkk7.com/swingboat/archive/2005/12/28/25649.html#Feedback0http://www.tkk7.com/swingboat/comments/commentRss/25649.htmlhttp://www.tkk7.com/swingboat/services/trackbacks/25649.htmlresponse.setHeader("Content-Type", "application/vnd.ms-excel;charset=GBK");
    response.setContentType("application/vnd.ms-excel;charset=GBK");

    swingboat 2005-12-28 09:13 发表评论
    ]]>
    在jboss4环境下,URL查询参数中支持中?/title><link>http://www.tkk7.com/swingboat/archive/2005/12/28/25650.html</link><dc:creator>swingboat</dc:creator><author>swingboat</author><pubDate>Wed, 28 Dec 2005 01:13:00 GMT</pubDate><guid>http://www.tkk7.com/swingboat/archive/2005/12/28/25650.html</guid><wfw:comment>http://www.tkk7.com/swingboat/comments/25650.html</wfw:comment><comments>http://www.tkk7.com/swingboat/archive/2005/12/28/25650.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/swingboat/comments/commentRss/25650.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/swingboat/services/trackbacks/25650.html</trackback:ping><description><![CDATA[在jboss4环境下,使URL参数中支持中文,例如Q?BR><A ><FONT color=#000080>http://site.net?name</FONT></A>=中国<BR>扑ֈjboss4的deploy\jbossweb-tomcat50.sar\server.xml,~辑该文Ӟ在下面的XML节点中增加红色的?BR><Connector port="8080" address="${jboss.bind.address}"<BR>         maxThreads="150" maxHttpHeaderSize="8192"<BR>         minSpareThreads="25" maxSpareThreads="75"<BR>         enableLookups="false" redirectPort="8443" acceptCount="100"<BR>         connectionTimeout="20000" disableUploadTimeout="true" <SPAN style="COLOR: red">URIEncoding="GBK" </SPAN>/> <img src ="http://www.tkk7.com/swingboat/aggbug/25650.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/swingboat/" target="_blank">swingboat</a> 2005-12-28 09:13 <a href="http://www.tkk7.com/swingboat/archive/2005/12/28/25650.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://badabg.com" target="_blank"></a>| <a href="http://9ts9.com" target="_blank">Ѷ</a>| <a href="http://sdbfgcjx.com" target="_blank">ҳַȫѹۿ12վ</a>| <a href="http://www-75044.com" target="_blank">a߹ۿ</a>| <a href="http://www-188588.com" target="_blank">ƵĻ</a>| <a href="http://5r7b.com" target="_blank">þþƷAV㽶</a>| <a href="http://dbyssw.com" target="_blank">޹˾Ʒԭ</a>| <a href="http://kppp4.com" target="_blank">þþƷAV鶹</a>| <a href="http://6132423.com" target="_blank">޾AA߹ۿSEE</a>| <a href="http://555yyyy.com" target="_blank">޶Ʒav</a>| <a href="http://wuiso.com" target="_blank">avҹƷһ</a>| <a href="http://9988u.com" target="_blank">vavavaĻ</a>| <a href="http://zjdoukai.com" target="_blank">޸Ƶһ</a>| <a href="http://147v.com" target="_blank">ۺϾþþþþĻ</a>| <a href="http://1y3c.com" target="_blank">ŷ޾Ʒ</a>| <a href="http://8v4y.com" target="_blank">˾þۺӰԺҳ</a>| <a href="http://tianwu520.com" target="_blank">ձ</a>| <a href="http://sanyoumiaomu.com" target="_blank">߹ۿ޾Ʒר</a>| <a href="http://usagaa.com" target="_blank">վ߹ۿ</a>| <a href="http://513109.com" target="_blank">ƵѲ</a>| <a href="http://zcrencai.com" target="_blank">ʮ˽Ƶ߹ۿڵ</a>| <a href="http://5g5t.com" target="_blank">ŮƵۿ</a>| <a href="http://3333seav.com" target="_blank">պƷһůů</a>| <a href="http://cin17.com" target="_blank">AëƬAĻ </a>| <a href="http://f2dai.com" target="_blank">þĻƷһ</a>| <a href="http://yygcui.com" target="_blank">ɫþþۺ</a>| <a href="http://popodino.com" target="_blank">˳˳ۺ</a>| <a href="http://blzcn.com" target="_blank">Ʒ޾Ʒۿ</a>| <a href="http://chinaedubrand.com" target="_blank">޹Ʒվ߲</a>| <a href="http://mmm19.com" target="_blank">Ů۳Ƶ߿</a>| <a href="http://hljc988.com" target="_blank">ֻˬִƵ </a>| <a href="http://c7372.com" target="_blank">Ʒרţţ</a>| <a href="http://gangxiangli.com" target="_blank">һëƬڲ</a>| <a href="http://goldwellib.com" target="_blank">ϼ˳߹ۿƵ</a>| <a href="http://zaideqin.com" target="_blank">ɫվַ</a>| <a href="http://chch12.com" target="_blank">ѱ̬Ƶַվ</a>| <a href="http://www321fafa.com" target="_blank">AVƬ߹ۿ </a>| <a href="http://8k4c.com" target="_blank">þþƷ</a>| <a href="http://ee45987.com" target="_blank">޹ƷۺϾþ</a>| <a href="http://www96008.com" target="_blank">337Pձŷ޴ͼ</a>| <a href="http://trgod.com" target="_blank">¾þƵ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>