java learnging

          一塊探討JAVA的奧妙吧
          posts - 34, comments - 27, trackbacks - 0, articles - 22

          1. Jabber是一種提供實時通信的協議。Jabber服務有著與Emai服務類似的服務方式:信息可以像Email那樣在不同Jabber服務器之間、Jabber服務器和客戶端之間發送和接收。
          2. Jabber把多種通信方式集成在一起,如:email,chat,group chat,IM Application。它使用一個類似與Email的通用通信地址(Universal Messaging Address)。
          3. Presense使Jabber用戶可以很方便的知道其他用戶的狀態,并采取合適的通信方式。
          4. 不僅用于消息傳遞,還可以用于計算機之間的通信。
          5. 還可以用Jabber Server 支持的Jabber網絡上構建你的應用程序,如在線游戲等。

          posted @ 2005-03-11 00:06 bigseal 閱讀(678) | 評論 (2)編輯 收藏

          對委托事件模型中幾個概念的理解:

          • 不同的操作,產生不同的事件類(Event),如窗口事件類WiondwEvent、單擊事件類ActionEvent
          • 每個事件類有相對應的事件監聽程序(Listener)(對事件對象的接收和處理)
          • 事件監聽程序的聲明在監聽程序接口(Listener Interface)中,如 WindowListernerActionListener

          傳遞及處理事件對象的流程

          • 注冊對應事件的監聽程序
          • 用某個類實現接口中的事件監聽程序,即委托該類實現它的事件的監聽程序
          • 運行時,系統將事件對象只傳遞給已注冊的事件監聽程序,并委托執行

          posted @ 2005-03-05 23:50 bigseal 閱讀(798) | 評論 (1)編輯 收藏

          web.xml文件的格式是在Servlet的規格說明書中定義的,所以這個文件格式可以用在任何與servlet相容(servlet-conforming )的Java servlet container。在Tomcat有兩個地方用到這個文件:$CATALINA_BASE/conf 文件夾和每個web應用程序。Tomcat每次配置一個應用程序(deploys an application )(在啟動或當應用程序載入的時候)時讀全局conf/web.xml,接著是應用程序中的WEB-INF/web.xml 。正如你所期望的conf/web.xml 文件中的設置會應用的所有的應用程序,而當前應用程序的WEB-INF/web.xml 僅僅應用到當前的應用程序。

          這個XML配置描述的根元素是
          web-app,這是頂層的元素,并且該文件元素必須按照下表的順序。這里沒有必需的元素,但最好應該有display-name來標識。
          Child elements of web-app

          Element

          Quantity allowed

          Meaning

          icon

          0 or 1

          A display file, for use in GUI administration tools

          display-name

          0 or 1

          Short name, for use in GUI admin tools

          description

          0 or 1

          Longer description

          distributable

          0 or 1

          Whether the web application can be load-balanced, i.e., distributed to multiple servers

          context-param

          0 or more

          Parameters to be made available to all servlets

          filter

          0 or more

          Provides a general-purpose servlet-based filtering mechanism

          filter-mapping

          0 or more

          Maps the invocation of a filter to either a servlet name or a URL pattern

          listener

          0 or more

          Context or session Listener classes

          servlet

          0 or more

          Short name, class name, and options for a servlet

          servlet-mapping

          0 or more

          Specifies any nondefault URL for a servlet

          session-config

          0 or 1

          Specifies session configuration (only session timeout in present version of specification)

          mime-mapping

          0 or more

          MIME types for files on server

          welcome-file- list

          0 or 1

          Alternate default page in directories

          error-page

          0 or more

          Alternate error page by HTTP error code

          taglib

          0 or more

          Tag library; see the section on the taglib element, later in this chapter

          resource-env-ref

          0 or more

          Reference to "administered objects," such as JMS queues

          resource-ref

          0 or more

          Reference to JNDI factory for objects such as SQL DataSources

          security- constraint

          0 or more

          Requires authentication (e.g., for a protected area of a web site)

          login-config

          0 or 1

          Specifies how the login mechanism is to work for a security-constraint

          security-role

          0 or more

          List name of security role, for use with security-constraint

          env-entry

          0 or more

          JNDI lookup of static objects

          ejb-ref

          0 or more

          Reference to EJBs used by servlets

          ejb-local-ref

          0 or more

          Reference to EJB local interfaces used by servlets


          posted @ 2005-03-04 00:03 bigseal 閱讀(1055) | 評論 (0)編輯 收藏

          1. Spring
          2. Hibernate
          3. Joboss
          4. Struct

          posted @ 2005-03-03 20:30 bigseal 閱讀(192) | 評論 (0)編輯 收藏

          雖然把它的安裝文件和源代碼都download了,但卻是一頭霧水,沒一點頭緒。

          今天問了一下,才知道是這樣的:
          jive實現了一個Jabber服務器,樣只要使用jabber協議就可以和jive通信了,然后做了一安裝程序把jelly 這個server 安裝,然后將自己war發布到jelly,再加上了一個自己的啟動腳本。

          這只是一個大概的框架,雖然明白了它的基本構架,可具體的實現還是不明白,決定從讀代碼開始。既然不能從整體上把握,就一點一點的啃代碼。

          posted @ 2005-03-03 20:25 bigseal 閱讀(424) | 評論 (0)編輯 收藏

          http://jakarta.apache.org/site/binindex.cgi
          Alexandria
          BCEL
          BSF
          Cactus
          Commons
          ECS
          Gump
          Jetspeed
          JMeter
          Log4J
          Lucene
          ORO
          POI
          Regexp
          Slide
          Struts
          Taglibs
          Tapestry
          Tomcat
          Turbine
          Velocity
          Watchdog
          http://jakarta.apache.org/commons/index.html
          BeanUtils
          Betwixt
          CLI
          Codec
          Collections
          Daemon
          DBCP
          Digester
          Discovery
          EL
          FileUpload
          HttpClient
          Jelly
          Jexl
          JXPath
          Lang
          Latka
          Logging
          Modeler
          Net
          Pool
          Validator

          posted @ 2005-03-03 10:24 bigseal 閱讀(191) | 評論 (0)編輯 收藏

                 看到一篇關于在eclipse中使用ant構建java項目的文章,就按照文章中的說明新建了一個項目,并新建了classes,dist,doc,lib幾個文件夾和build.xml文件。其中build.xml文件的內容也是直接復制的,由于是從網頁上直接復制的,里面“<”“>”都是中文格式的,我就把這些給替換了一下。
                   但當選中項目,然后選擇“Project”,“Properties”,“Builders”,“New…”,選擇“Ant Build”:載入“Bulidfile”時提示“Content is not allowed in prolog”錯誤。    
                   我就去Google上轉了一圈,還有點收獲,看了一篇小文章,覺得可能是build.xml文件格式的錯誤。

          In SGML and XML, a document is composed of two sequential parts,
          the prolog and the instance. You can see this in an HTML example:

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN "
          2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " 
          >
          <html xmlns= "http://www.w3.org/1999/xhtml " >
          <head >
          <title >The Symbol Grounding Problem </title >
          </head >
          <body >
          </body >
          </html >

          In this example, the prolog is lines 1-2, the instance begins on
          line 3. The prolog includes the DOCTYPE declaration, the external
          subset (called the DTD), and the internal subset (which you seldom
          see but it 's legal). The document instance includes the document
          element (in this case 
          <html > and all of its descendent content).

          You generally don 't want to see the prolog, and you generally don 't
          want to store it. The DOCTYPE declaration provides references to
          DTD, which is instantiated as part of the process of validating the
          document. You may want to store the reference(s), but you wouldn 't
          want to store the DTD each time you store the document, as that
          would be a real waste (the DTD is often bigger than the document).

          It sounds like your well-formed and valid document isn 't being
          considered as such by the XML processor. The error message indicates
          that there is content (i.e., either elements or character data) in
          the part of the document considered as the prolog. You may be missing
          the last " > " on line 2 above, as that would normally be the beginning
          of the internal subset. If it found " 
          <html " (or something similar),
          you might get that error.
          果然,有兩個“!”是中文狀態,改過來就ok 了。

          posted @ 2005-02-27 11:09 bigseal 閱讀(21016) | 評論 (7)編輯 收藏

          UploadBean 1.5  是100%的JAVA 上載文件組件(JavaBean)。該組 件可以和任何 JSP/Servlets應用程序整合。你可以將上載的文件存儲在 文件夾ZIP文件數據庫內存中。并且可以加上一些限制條件:文件大小 ,黑名單,白名單,最大上載文件數。如果上載成功,該組件將發出上載事件, 此事件可以被指定的監聽器捕獲。該組件對于非商業性的使用是免費的。 這里提供一些工具,比如:email notification,progress bar 自定義數據庫存儲例程,中文上載jsp ...

          用了一下,感覺還不錯,并且每個功能都有實例及詳細說明。

          http://www.javazoom.net/jzservlets/uploadbean/uploadbean_cn.html

          posted @ 2005-01-25 12:40 bigseal 閱讀(296) | 評論 (0)編輯 收藏

          有兩類:Tools和Test。

          Tools類中定義了一系列方法,諸如tools1(),tools2(),......,在Test類中有多個方法調用Tools類中的方法,但也不是所有 的方法都有對Tools類的方法的調用。

          那么我在Test類中什么時候創建Tools類的實例合適呢?

          1.把Tools tools作為Test的數據成員,在Test構造器中創建tools,這樣在Test的方法中就可以直接使用

           

          Class Test{
            
            Tools tools;
            

            
          public Test(){
                  tools 
          = new Tools(); //創建
              }


            
            
          public void testMethod(){
                  tools.toolsMethod(); 
          // 使用
            }

           

          2.在Test的每個方法中聲明并創建Tools類的實例

           

          class Test{
              

              
          public void testMethod(){
                 
          new Tools().toolsMethod)();//創建并調用 
              }


              
          }

           

          或者其它更好的方法?

          posted @ 2005-01-15 11:05 bigseal 閱讀(924) | 評論 (2)編輯 收藏

          JDBC驅動程序

          JDBC通過一系列接口來訪問數據庫,而這些接口的實現則是由不同的數據庫廠商或組織實現的。要實現對某一特定類型數據庫的訪問就要通過注冊JDBC驅動程序來讓程序知道去哪里調用JDBC API 接口的實現。

          先看下面的一段程序:

          Class.froName("com.mysql.jdbc.Driver").newInstance();//加載類并初始化這個類的靜態初始化部分
          String url = "jdbc:mysql://localhost:3306/math";               //數據庫URL
          String userName = "root";                                                     //連接數據庫的用戶名
          String password = "password";                                            //密碼
          Connection oConn = DriverManager.getConnection(url,userName,password);//建立數據庫連接

          java.sql.DriverManager:從名字就可以看出是用于驅動程序管理的,它的主要責任是保留一個驅動程序的列表,并通過getConnection方法來給應用程序提供與所請求的URL相匹配的Driver(可能是由于同一個數據庫的驅動程序可能是有幾種不同的實現方式,但如果DriverManager中對一個URL有多個匹配的Driver,它是不是只選擇第一個找到的呢?),并返回Connection對象,如果找不到就會拋出一個異常,也就是這一句 Connection oConn = DriverManager.getConnection(url,userName,password)。同時還提供了registerDriver()和deregisterDriver(),這兩個方法允許驅動程序的工具用DriverManager注冊驅動程序或從列表中刪除。可以感覺出是在用Class.froName("com.mysql.jdbc.Driver").newInstance();加載類并初始化這個類的靜態初始化部分時調用registerDriver()的方法注冊的,我在mysql驅動程序的源碼的Driver類中找到對這個方法的調用。

          package com.mysql.jdbc;
          public class Driver extends NonRegisteringDriver 
          {
            

              
          //

              
          // Register ourselves with the DriverManager
              
          //
              static 
          {
                  
          try 
          {
                      java.sql.DriverManager.registerDriver(
          new
           Driver());
                  }
           catch (java.sql.SQLException E) {
                      
          throw new RuntimeException("Can't register driver!"
          );
                  }


                  
          if (DEBUG) {
                      Debug.trace(
          "ALL"
          );
                  }

              }


              
          /**
               * Construct a new driver and register it with DriverManager
               *
               * @throws java.sql.SQLException if a database error occurs.
               
          */

              
          public Driver() throws java.sql.SQLException {
                  
          // Required for Class.forName().newInstance()

              }

          }

          posted @ 2005-01-15 00:51 bigseal 閱讀(725) | 評論 (0)編輯 收藏

          僅列出標題
          共4頁: 上一頁 1 2 3 4 下一頁 
          主站蜘蛛池模板: 蒙阴县| 永城市| 临武县| 黔西县| 会泽县| 四平市| 固原市| 汾阳市| 永济市| 孟津县| 天台县| 梅河口市| 鹤峰县| 平塘县| 西乡县| 周至县| 广元市| 亳州市| 万载县| 芜湖县| 潜山县| 城步| 聂拉木县| 长春市| 长子县| 岐山县| 乐清市| 乌兰察布市| 海宁市| 小金县| 客服| 定安县| 循化| 白水县| 灌南县| 天柱县| 肃宁县| 左权县| 虎林市| 通化市| 高邑县|