锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲偷自拍另类图片二区,午夜亚洲福利在线老司机,午夜亚洲国产成人不卡在线http://m.tkk7.com/zhangyuan/category/45559.html緇忕悊鐨勭┖闂?/description>zh-cnMon, 06 Sep 2010 13:23:43 GMTMon, 06 Sep 2010 13:23:43 GMT60JAVA鎷︽埅鍣ㄥ師鐞嗗強Struts2鎵╁睍http://m.tkk7.com/zhangyuan/archive/2010/09/06/331229.html銇堢粡鐞嗐亪銇堢粡鐞嗐亪Mon, 06 Sep 2010 09:21:00 GMThttp://m.tkk7.com/zhangyuan/archive/2010/09/06/331229.htmlhttp://m.tkk7.com/zhangyuan/comments/331229.htmlhttp://m.tkk7.com/zhangyuan/archive/2010/09/06/331229.html#Feedback0http://m.tkk7.com/zhangyuan/comments/commentRss/331229.htmlhttp://m.tkk7.com/zhangyuan/services/trackbacks/331229.html鏈榪戝彂鐜板緢澶氭湅鍙嬭繛鎷︽埅鍣ㄩ兘涓嶇煡閬擄紝浜庢槸鎯沖啓涓狟LOG鎬葷粨涓涓嬨?br /> java鎷︽埅鍣ㄧ殑鍩烘湰鍘熺悊鍏跺疄闈炲父綆鍗曪紝璇寸櫧浜嗗氨鏄姩鎬佷唬鐞嗙被銆?br /> 涓嬮潰鏉ョ湅涓涓畝鍗曠殑渚嬪瓙
棣栧厛錛屾垜寤虹珛涓涓嫤鎴櫒鐨勭被InterceptorClass錛岃繖閲岀殑before()鍜宎fter()鏂規硶鏄互鍚庢嫤鎴櫒浼氭墽琛岀殑鏂規硶
CODE娓呭崟涓錛?br />

public class InterceptorClass {
 
public void before()
  System.out.println(
"鎷︽埅鍣↖nterceptorClass鏂規硶璋冪敤:before()!"); 
 }
 
 
public void after()
     System.out.println(
"鎷︽埅鍣↖nterceptorClass鏂規硶璋冪敤:after()!"); 
 }

}

 

鎴戜滑妯℃嫙涓涓笟鍔$粍浠舵帴鍙usinessInterface錛屽拰涓涓笟鍔$粍浠跺疄鐜扮被BusinessClass
CODE娓呭崟浜岋細

public interface BusinessInterface {
 
public void doSomething();
}

 

CODE娓呭崟涓夛細

public class BusinessClass implements BusinessInterface {
 
public void doSomething() {
   System.out.println(
"涓氬姟緇勪歡BusinessClass鏂規硶璋冪敤:doSomething()"); 
 }

}

 

鐒跺悗錛屽垱寤轟竴涓姩鎬佷唬鐞嗙被DynamicProxyHandler錛岃繖涓被鏄泦鎴怚nvocationHandler鎺ュ彛鐨勶紝鍔ㄦ佺被鐨勫師鐞嗗疄闄呬笂鏄嬌寰楀綋浣犳墽琛屼竴涓姩鎬佹柟

娉曠殑鏃跺欙紝浠栧彲浠ユ妸榪欎釜鍔ㄦ佹柟娉昫ispatch鍒拌繖涓姩鎬佺被涓婃潵銆傝繖鏍鳳紝浣犲氨鍙互鍦ㄨ繖涓柟娉曠殑鍓嶅悗宓屽叆鑷繁鐨勪竴浜涙柟娉曘?br /> CODE娓呭崟鍥涳細
//鍖呭惈浜嗕笟鍔″璞$粦瀹氬姩鎬佷唬鐞嗙被鐨勫鐞嗭紝騫跺疄鐜頒簡InvocationHandler鎺ュ彛鐨刬nvoke鏂規硶

public class DynamicProxyHandler implements InvocationHandler {
 
private Object business;//琚唬鐞嗗璞?/span>
 private InterceptorClass inceptor = new InterceptorClass();//鎷︽埅鍣?br />  
 
// 鍔ㄦ佺敓鎴愪竴涓唬鐞嗙被瀵硅薄,騫剁粦瀹氳浠g悊綾誨拰浠g悊澶勭悊鍣?/span>
 public Object bind(Object business) {
   
this.business = business;
   
return Proxy.newProxyInstance(
     
//琚唬鐞嗙被鐨凜lassLoader
     business.getClass().getClassLoader(),
     
//瑕佽浠g悊鐨勬帴鍙?鏈柟娉曡繑鍥炲璞′細鑷姩澹扮О瀹炵幇浜嗚繖浜涙帴鍙?/span>
     business.getClass().getInterfaces(), 
     
//浠g悊澶勭悊鍣ㄥ璞?/span>
     this);
 }


 
 // 浠g悊瑕佽皟鐢ㄧ殑鏂規硶,騫跺湪鏂規硶璋冪敤鍓嶅悗璋冪敤榪炴帴鍣ㄧ殑鏂規硶

 /**
  * 
@param proxy  浠g悊綾誨璞?br />   * @param method 琚唬鐞嗙殑鎺ュ彛鏂規硶
  * 
@param args   琚唬鐞嗘帴鍙f柟娉曠殑鍙傛暟
  * 
@throws Throwable
  
*/

 
public Object invoke(Object proxy, Method method, Object[] args)
   
throws Throwable {
  Object result 
= null;
  inceptor.before();
  result
=method.invoke(business,args);
  inceptor.after();
  
return result;
 }


OK錛屾垜浠潵鍐欎釜綾繪祴璇曚竴涓?br /> CODE娓呭崟浜旓細

public static void main(String[] args) {
  
//鐢熸垚鍔ㄦ佷唬鐞嗙被瀹炰緥
  DynamicProxyHandler handler = new DynamicProxyHandler();
  
//鐢熸垚寰呮祴璇曠殑涓氬姟緇勪歡瀵硅薄
        BusinessInterface business = new BusinessClass();
        
//灝嗕笟鍔$粍浠跺璞″拰鍔ㄦ佷唬鐞嗙被瀹炰緥緇戝畾
        BusinessInterface businessProxy = (BusinessInterface) handler.bind(business);
        
//鐢ㄥ姩鎬佷唬鐞嗙被璋冪敤鏂規硶
        businessProxy.doSomething();
 }


鏉ョ湅鐪嬬粨鏋滐細


榪戞湡struts2寰堟祦琛岋紝鑰屼笖鎷︽埅鍣ㄦ槸struts2閲岄潰涓涓瘮杈冨ソ鐨勫姛鑳斤紝涓嬮潰涓句釜渚嬪瓙璇存槑涓涓嬫嫤鎴櫒鍦╯truts2涓殑鐢ㄦ硶銆?br /> struts2瀵規嫤鎴櫒瀹炵幇鍋氫簡涓涓皝瑁咃紝浣垮緱鎴戜滑鍦ㄥ疄鐜扮殑鏃跺欐瘮杈冪畝鍗曘?br /> 棣栧厛鎴戜滑瑕佸緩涓涓嫤鎴櫒綾?br /> CODE娓呭崟鍏細

public class AuthorizationInterceptor extends AbstractInterceptor {
 @Override
 
public String intercept(ActionInvocation invocation) throws Exception {
  Map session 
= invocation.getInvocationContext().getSession();
  String userName 
= (String) session.get("userName");
  
if ( userName != null && userName.equals("test")) {
   System.out.println(
"鎷︽埅鍣細鍚堟硶鐢ㄦ埛鐧誨綍---");
   
return invocation.invoke();
  }

  
else
  
{
   System.out.println(
"鎷︽埅鍣細鐢ㄦ埛鏈櫥褰?--");
   
return Action.LOGIN;
  }

 }

}


榪欎釜綾繪槸蹇呴』瑕佺戶鎵縮truts2鍖呬腑鎻愪緵鐨凙bstractInterceptor綾伙紝榪欎釜綾繪湁涓涓娊璞℃柟娉昳ntercept錛岃繖涓柟娉曟槸蹇呴』瑕佸疄鐜扮殑銆?br /> 閭d箞緇忕悊鍦ㄨ繖涓嫤鎴櫒閲岄潰鍐欎簡涓涓畝鍗曠殑瀹炵幇錛屽url鐢ㄦ埛鍚堟硶鎬у仛浜嗕竴涓檺鍒躲?/p>

鎺ヤ笅鏉ユ瘮杈冨叧閿殑鏄繃婊ゅ櫒鍦╯truts2涓殑閰嶇疆錛屽厛鐪嬬湅浠g爜
CODE娓呭崟涓冿細

<package name="system" extends="struts-default">
  
<interceptors>
   
<!--  瀹氫箟鏉冮檺鎺у埗鎷︽埅鍣?nbsp; -->
   
<interceptor name="authority" 

class
="com.sharesin.biz.common.intercepts.struts2.AuthorizationInterceptor"/>
   
<!-- 瀹氫箟涓涓寘鍚潈闄愭帶鍒剁殑鎷︽埅鍣ㄦ爤   -->
   
<interceptor-stack name="mystack">
    
<interceptor-ref name="defaultStack"></interceptor-ref>
    
<interceptor-ref name="authority"></interceptor-ref>
   
</interceptor-stack>
  
</interceptors>
   
<!--瀹氫箟榛樿鎷︽埅鍣?nbsp;  -->
        
<default-interceptor-ref name="mystack" />
   
<!--瀹氫箟鍏ㄥ眬澶勭悊緇撴灉   -->
  
<global-results>
   
<result name="login">index.jsp</result>
  
</global-results>
  
<action name="login_*" class="com.sharesin.biz.web.system.LoginAction" method="{1}">
   
<result name="success">system/homepage.jsp</result>
  
</action>
 
</package>


鍦╥nterceptors鑺傜偣閲岋紝鎴戜滑鍙互瀹氫箟澶氫釜鎷︽埅鍣紝榪欓噷鐨勫悕涓篴uthority鐨勫彧鏄叾涓殑涓涓俿truts2鐨勬嫤鎴櫒鏍堟垜鏄厛鎵цstruts2榛樿鐨勬嫤

鎴櫒defaultStack錛岀劧鍚庡啀鎵ц鎴戠殑銆傜劧鍚庡彧闇瑕佺敤default-interceptor-ref鏍囩璁劇疆濂借繖涓猻ystem鍖呬腑鐨勯粯璁ゆ嫤鎴櫒涓鴻繖涓嫤鎴櫒灝監K浜嗐?/p>

struts2涓紩鍏ヤ簡package榪欎釜姒傚康錛屾垜瑙夊緱鍗佸垎瀹炵敤錛屽綋鐒惰繖瀵箂truts2鎷︽埅鍣ㄤ篃鏄釜瀹炴儬錛屾垜浠彲浠ユ牴鎹笉鍚岀殑action鏉ュ垎鍖呭拰涓嶅悓鐨勬嫤鎴櫒


ok錛屾潵榪愯嫻嬭瘯涓涓嬨?/p>


緇撴灉..


 

 

 

 

 



]]>
鍏充簬Integer澶у皬姣旇緝鐨勯棶棰?/title><link>http://m.tkk7.com/zhangyuan/archive/2010/07/24/327011.html</link><dc:creator>銇堢粡鐞嗐亪</dc:creator><author>銇堢粡鐞嗐亪</author><pubDate>Sat, 24 Jul 2010 08:03:00 GMT</pubDate><guid>http://m.tkk7.com/zhangyuan/archive/2010/07/24/327011.html</guid><wfw:comment>http://m.tkk7.com/zhangyuan/comments/327011.html</wfw:comment><comments>http://m.tkk7.com/zhangyuan/archive/2010/07/24/327011.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://m.tkk7.com/zhangyuan/comments/commentRss/327011.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/zhangyuan/services/trackbacks/327011.html</trackback:ping><description><![CDATA[鏄ㄥぉ璺熸湅鍙嬩竴璧峰悆楗紝浠栬鍒頒袱涓狪nteger綾誨瀷鍊兼瘮杈冩槸鍚︾浉絳夌殑闂銆傜粡鐞嗕篃鍦ㄨ繖閲屾妸java鐨処nteger鍊兼瘮杈冪殑闂鎷垮嚭鏉ヨ涓璇淬傚洜涓哄湪闈㈣瘯鐨勬椂鍊欒繖涓槸緇忓父閬囧埌鐨勯棶棰樸?br /> 棣栧厛緇欏ぇ瀹剁湅涓涓緥瀛愶細<br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080"> 1</span><img id="Codehighlighter1_18_273_Open_Image" onclick="this.style.display='none'; Codehighlighter1_18_273_Open_Text.style.display='none'; Codehighlighter1_18_273_Closed_Image.style.display='inline'; Codehighlighter1_18_273_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_18_273_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_18_273_Closed_Text.style.display='none'; Codehighlighter1_18_273_Open_Image.style.display='inline'; Codehighlighter1_18_273_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" /><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> Test </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_18_273_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_18_273_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080"> 2</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img id="Codehighlighter1_22_64_Open_Image" onclick="this.style.display='none'; Codehighlighter1_22_64_Open_Text.style.display='none'; Codehighlighter1_22_64_Closed_Image.style.display='inline'; Codehighlighter1_22_64_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_22_64_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_22_64_Closed_Text.style.display='none'; Codehighlighter1_22_64_Open_Image.style.display='inline'; Codehighlighter1_22_64_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />    </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_22_64_Closed_Text">/** */</span><span id="Codehighlighter1_22_64_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> </span><span style="color: #008080"> 4</span><span style="color: #008000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />     * 鍏充簬Integer澶у皬姣旇緝闂<br /> </span><span style="color: #008080"> 5</span><span style="color: #008000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />     * </span><span style="color: #808080">@author</span><span style="color: #008000"> 緇忕悊<br /> </span><span style="color: #008080"> 6</span><span style="color: #008000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />     </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_106_271_Open_Image" onclick="this.style.display='none'; Codehighlighter1_106_271_Open_Text.style.display='none'; Codehighlighter1_106_271_Closed_Image.style.display='inline'; Codehighlighter1_106_271_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_106_271_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_106_271_Closed_Text.style.display='none'; Codehighlighter1_106_271_Open_Image.style.display='inline'; Codehighlighter1_106_271_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> main(String[] args) </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_106_271_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_106_271_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080"> 8</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        Integer a </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">10</span><span style="color: #000000">;<br /> </span><span style="color: #008080"> 9</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        Integer b </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">10</span><span style="color: #000000">;<br /> </span><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">a==b : </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> String.valueOf(a</span><span style="color: #000000">==</span><span style="color: #000000">b));<br /> </span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">a.equals(b) : </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> String.valueOf(a.equals(b)));<br /> </span><span style="color: #008080">12</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />    }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">13</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">14</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span></div> 榪愯涓涓嬶紝鍦ㄦ帶鍒跺彴寰楀埌鐨勭粨鏋滄槸榪欐牱鐨?br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #000000">a</span><span style="color: #000000">==</span><span style="color: #000000">b : </span><span style="color: #0000ff">true</span><span style="color: #000000"><br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />a.equals(b) : </span><span style="color: #0000ff">true</span></div> <br /> 褰撴槸褰撴垜浠彉鎹竴涓嬪?br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080"> 1</span><img id="Codehighlighter1_18_277_Open_Image" onclick="this.style.display='none'; Codehighlighter1_18_277_Open_Text.style.display='none'; Codehighlighter1_18_277_Closed_Image.style.display='inline'; Codehighlighter1_18_277_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_18_277_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_18_277_Closed_Text.style.display='none'; Codehighlighter1_18_277_Open_Image.style.display='inline'; Codehighlighter1_18_277_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" /><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> Test </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_18_277_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_18_277_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080"> 2</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /> </span><span style="color: #008080"> 3</span><span style="color: #000000"><img id="Codehighlighter1_22_64_Open_Image" onclick="this.style.display='none'; Codehighlighter1_22_64_Open_Text.style.display='none'; Codehighlighter1_22_64_Closed_Image.style.display='inline'; Codehighlighter1_22_64_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_22_64_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_22_64_Closed_Text.style.display='none'; Codehighlighter1_22_64_Open_Image.style.display='inline'; Codehighlighter1_22_64_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />    </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_22_64_Closed_Text">/** */</span><span id="Codehighlighter1_22_64_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> </span><span style="color: #008080"> 4</span><span style="color: #008000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />     * 鍏充簬Integer澶у皬姣旇緝闂<br /> </span><span style="color: #008080"> 5</span><span style="color: #008000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />     * </span><span style="color: #808080">@author</span><span style="color: #008000"> 緇忕悊<br /> </span><span style="color: #008080"> 6</span><span style="color: #008000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />     </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_106_275_Open_Image" onclick="this.style.display='none'; Codehighlighter1_106_275_Open_Text.style.display='none'; Codehighlighter1_106_275_Closed_Image.style.display='inline'; Codehighlighter1_106_275_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_106_275_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_106_275_Closed_Text.style.display='none'; Codehighlighter1_106_275_Open_Image.style.display='inline'; Codehighlighter1_106_275_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> main(String[] args) </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_106_275_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_106_275_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080"> 8</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        Integer a </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"> 9</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        Integer b </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">10</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">a==b : </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> String.valueOf(a</span><span style="color: #000000">==</span><span style="color: #000000">b));<br /> </span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">a.equals(b) : </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> String.valueOf(a.equals(b)));<br /> </span><span style="color: #008080">12</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />    }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">13</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span></div> <br /> 榪愯涓涓嬶紝鎺у埗鍙扮殑緇撴灉鍙堟槸<br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #000000">a</span><span style="color: #000000">==</span><span style="color: #000000">b : </span><span style="color: #0000ff">false</span><span style="color: #000000"><br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />a.equals(b) : </span><span style="color: #0000ff">true</span></div> <br /> 榪欐槸浠涔堝師鍥犲憿錛熸垜褰撴椂涔熸湁鐐圭姱緋婃秱銆傛湁鐐瑰啿鍔ㄥ氨鐩存帴寮婧愮爜鐪嬩簡銆?br /> 瀹為檯涓婂湪鎴戜滑鐢↖nteger a = 鏁板瓧錛涙潵璧嬪肩殑鏃跺橧nteger榪欎釜綾繪槸璋冪敤鐨刾ublic static Integer valueOf(int i)榪欎釜鏂規硶銆?br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080">1</span><img id="Codehighlighter1_37_187_Open_Image" onclick="this.style.display='none'; Codehighlighter1_37_187_Open_Text.style.display='none'; Codehighlighter1_37_187_Closed_Image.style.display='inline'; Codehighlighter1_37_187_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_37_187_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_37_187_Closed_Text.style.display='none'; Codehighlighter1_37_187_Open_Image.style.display='inline'; Codehighlighter1_37_187_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" /><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> Integer valueOf(</span><span style="color: #0000ff">int</span><span style="color: #000000"> i) </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_37_187_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_37_187_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080">2</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        </span><span style="color: #0000ff">if</span><span style="color: #000000">(i </span><span style="color: #000000">>=</span><span style="color: #000000"> </span><span style="color: #000000">-</span><span style="color: #000000">128</span><span style="color: #000000"> </span><span style="color: #000000">&&</span><span style="color: #000000"> i </span><span style="color: #000000"><=</span><span style="color: #000000"> IntegerCache.high)<br /> </span><span style="color: #008080">3</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />            </span><span style="color: #0000ff">return</span><span style="color: #000000"> IntegerCache.cache[i </span><span style="color: #000000">+</span><span style="color: #000000"> </span><span style="color: #000000">128</span><span style="color: #000000">];<br /> </span><span style="color: #008080">4</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        </span><span style="color: #0000ff">else</span><span style="color: #000000"><br /> </span><span style="color: #008080">5</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />            </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> Integer(i);<br /> </span><span style="color: #008080">6</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />    }</span></span></div> 鎴戜滑鏉ョ湅鐪媀alueOf(int i)鐨勪唬鐮侊紝鍙互鍙戠幇浠栧浼犲叆鍙傛暟i鍋氫簡涓涓猧f鍒ゆ柇銆傚湪-128<=i<=127鐨勬椂鍊欐槸鐩存帴鐢ㄧ殑int鍘熷鏁版嵁綾誨瀷錛岃岃秴鍑轟簡榪欎釜鑼冨洿鍒欐槸new浜嗕竴涓璞°傛垜浠煡閬?=="絎﹀彿鍦ㄦ瘮杈冨璞$殑鏃跺欐槸姣旇緝鐨勫唴瀛樺湴鍧錛岃屽浜庡師濮嬫暟鎹被鍨嬫槸鐩存帴姣斿鐨勬暟鎹箋傞偅涔堣繖涓棶棰樺氨瑙e喅浜嗐?br /> 鑷充簬涓轟粈涔堢敤int鍨嬬殑鏃跺欏間細鍦?128<=i<=127鑼冨洿鍛㈠憿?鎴戜滑鐭ラ亾鍏綅浜岃繘鍒剁殑琛ㄧず鐨勮寖鍥存濂藉氨鏄?128鍒?27銆傚ぇ姒傚氨鏄洜涓鴻繖鍚с?br /> <br /> 鎶婂鉤鏃跺嚭鐜扮殑闂璁板綍涓嬫潵錛岃嚜宸卞氨鍙互涓鐐逛竴鐐硅繘姝ヤ簡銆? <img src ="http://m.tkk7.com/zhangyuan/aggbug/327011.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/zhangyuan/" target="_blank">銇堢粡鐞嗐亪</a> 2010-07-24 16:03 <a href="http://m.tkk7.com/zhangyuan/archive/2010/07/24/327011.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>JAVA璇誨彇閰嶇疆鏂囦歡http://m.tkk7.com/zhangyuan/archive/2010/07/12/325843.html銇堢粡鐞嗐亪銇堢粡鐞嗐亪Mon, 12 Jul 2010 03:48:00 GMThttp://m.tkk7.com/zhangyuan/archive/2010/07/12/325843.htmlhttp://m.tkk7.com/zhangyuan/comments/325843.htmlhttp://m.tkk7.com/zhangyuan/archive/2010/07/12/325843.html#Feedback4http://m.tkk7.com/zhangyuan/comments/commentRss/325843.htmlhttp://m.tkk7.com/zhangyuan/services/trackbacks/325843.html 榪欓噷鍐欎簡涓涓緥瀛愶紝鍏堢粰澶у鐪嬬湅鐩綍緇撴瀯

緇忕悊鏄敤properties鏂囦歡鏉ュ仛鐨勶紝鍥犱負榪欎釜闈炲父綆鍗曪紝鑰屼笖璇誨彇properties鏂囦歡鐨勯熷害姣旇xml瑕佸揩鐨勫銆?br /> 榪欓噷鐨勪富瑕佹枃浠舵湁涓や釜錛歝onfig.properties鏄厤緗枃浠訛紝Test鏄祴璇昷ava綾?br /> config鏂囦歡鐨勫唴瀹瑰氨鏄竴涓猧p涓涓猵ort

鍘熺悊寰堢畝鍗曞氨鏄鍏堝彇寰梒onfig.properties鐨勪簩榪涘埗嫻侊紝鐒跺悗鐢↗AVA灝佽濂界殑Properties綾繪妸榪欎釜嫻乴oad榪涙潵錛屾渶鍚庡彧闇瑕佺敤Properties瀵硅薄涓殑getProperty(String key)鏂規硶灝卞彲浠ュ彇鍊間簡銆傛槸涓嶆槸寰堢畝鍗曘?br /> 緇欏ぇ瀹剁湅鐪嬩唬鐮侊細

鎴戜滑鏉ヨ繍琛屼笅緇撴灉錛?br />
鎴愬姛浜唦


]]>
主站蜘蛛池模板: 成年女人喷潮毛片免费播放| 桃子视频在线观看高清免费视频| 在线视频免费观看高清| 亚洲欧洲在线观看| 久久精品一本到99热免费| 亚洲精品蜜桃久久久久久| 又粗又长又爽又长黄免费视频| 在线观看永久免费视频网站| 亚洲日本天堂在线| 国产婷婷高清在线观看免费| 亚洲成在人线aⅴ免费毛片| 日本19禁啪啪无遮挡免费动图| 国产99久久亚洲综合精品| 免费va人成视频网站全| 国产精品免费久久| 亚洲视频.com| 无码免费午夜福利片在线| 久久精品国产亚洲AV电影网| 亚洲AV日韩精品一区二区三区| 中文字幕一区二区免费| 亚洲天堂视频在线观看| 欧亚精品一区三区免费| 亚洲av日韩专区在线观看| 亚洲免费日韩无码系列| 午夜视频在线免费观看| 亚洲综合色婷婷在线观看| 四虎国产精品免费视| 免费精品久久天干天干| 亚洲图片中文字幕| 国产在线98福利播放视频免费| caoporm碰最新免费公开视频 | 免费国产高清视频| 国产免费人成视频在线播放播| 亚洲人成在线观看| 性做久久久久免费观看| 永久免费AV无码网站国产| 亚洲综合在线一区二区三区| 亚洲日韩精品一区二区三区无码| 成人黄色免费网站| 成年网站免费入口在线观看| 亚洲精品中文字幕无码AV|