afunms

          My Software,My Dream—Forge a more perfect NMS product.

          new framework(8)--import static

          現在J2SE 5.0提供了靜態導入的功能,你只需要在import關鍵字后面寫一個static關鍵字就可以直接
          使用類中定義的常量了,例如

          import static afu.framework.util.Constant.CURRENT_USER;
          import static afu.framework.util.Constant.EXCEPTION_MESSAGE;

              public String login()
              
          {
                  String userId 
          = getParaValue("userid");
                  String password 
          = getParaValue("password");
                  String remoteIp 
          = request.getRemoteAddr();
                  UserDto dto 
          = ((SysService)service).login(userId, password, remoteIp);
                  
                  
          if(dto==null)
                  
          {
                      request.setAttribute(EXCEPTION_MESSAGE,
          "用戶名或密碼不對");
                      
          return null;
                  }

                  request.setAttribute(CURRENT_USER,dto);
                  
          return "/common/index.jsp";
              }


          而沒有這個功能之前,我們得這么寫
          request.setAttribute(Constant.EXCEPTION_MESSAGE,"用戶名或密碼不對");

          posted on 2007-05-08 10:40 afunms 閱讀(114) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          My Links

          News

          留言簿(18)

          隨筆檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          主站蜘蛛池模板: 甘南县| 大丰市| 岐山县| 织金县| 什邡市| 黑水县| 栾城县| 克什克腾旗| 龙南县| 广南县| 乐亭县| 娱乐| 武义县| 新巴尔虎右旗| 定安县| 东方市| 涪陵区| 揭东县| 武汉市| 永泰县| 宝山区| 隆林| 罗平县| 南部县| 大余县| 西吉县| 阳春市| 五台县| 广东省| 鄂托克前旗| 金乡县| 稷山县| 青神县| 温宿县| 宁安市| 淮南市| 句容市| 武义县| 安溪县| 安义县| 吴川市|