java learnging

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

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

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

          對(duì)委托事件模型中幾個(gè)概念的理解:

          • 不同的操作,產(chǎn)生不同的事件類(Event),如窗口事件類WiondwEvent、單擊事件類ActionEvent
          • 每個(gè)事件類有相對(duì)應(yīng)的事件監(jiān)聽(tīng)程序(Listener)(對(duì)事件對(duì)象的接收和處理)
          • 事件監(jiān)聽(tīng)程序的聲明在監(jiān)聽(tīng)程序接口(Listener Interface)中,如 WindowListernerActionListener

          傳遞及處理事件對(duì)象的流程

          • 注冊(cè)對(duì)應(yīng)事件的監(jiān)聽(tīng)程序
          • 用某個(gè)類實(shí)現(xiàn)接口中的事件監(jiān)聽(tīng)程序,即委托該類實(shí)現(xiàn)它的事件的監(jiān)聽(tīng)程序
          • 運(yùn)行時(shí),系統(tǒng)將事件對(duì)象只傳遞給已注冊(cè)的事件監(jiān)聽(tīng)程序,并委托執(zhí)行

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

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

          這個(gè)XML配置描述的根元素是
          web-app,這是頂層的元素,并且該文件元素必須按照下表的順序。這里沒(méi)有必需的元素,但最好應(yīng)該有display-name來(lái)標(biāo)識(shí)。
          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 閱讀(1054) | 評(píng)論 (0)編輯 收藏

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

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

          雖然把它的安裝文件和源代碼都download了,但卻是一頭霧水,沒(méi)一點(diǎn)頭緒。

          今天問(wèn)了一下,才知道是這樣的:
          jive實(shí)現(xiàn)了一個(gè)Jabber服務(wù)器,樣只要使用jabber協(xié)議就可以和jive通信了,然后做了一安裝程序把jelly 這個(gè)server 安裝,然后將自己war發(fā)布到j(luò)elly,再加上了一個(gè)自己的啟動(dòng)腳本。

          這只是一個(gè)大概的框架,雖然明白了它的基本構(gòu)架,可具體的實(shí)現(xiàn)還是不明白,決定從讀代碼開(kāi)始。既然不能從整體上把握,就一點(diǎn)一點(diǎn)的啃代碼。

          posted @ 2005-03-03 20:25 bigseal 閱讀(423) | 評(píng)論 (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) | 評(píng)論 (0)編輯 收藏

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

          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.
          果然,有兩個(gè)“!”是中文狀態(tài),改過(guò)來(lái)就ok 了。

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

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

          用了一下,感覺(jué)還不錯(cuò),并且每個(gè)功能都有實(shí)例及詳細(xì)說(shuō)明。

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

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

          有兩類:Tools和Test。

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

          那么我在Test類中什么時(shí)候創(chuàng)建Tools類的實(shí)例合適呢?

          1.把Tools tools作為T(mén)est的數(shù)據(jù)成員,在Test構(gòu)造器中創(chuàng)建tools,這樣在Test的方法中就可以直接使用

           

          Class Test{
            
            Tools tools;
            

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


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

           

          2.在Test的每個(gè)方法中聲明并創(chuàng)建Tools類的實(shí)例

           

          class Test{
              

              
          public void testMethod(){
                 
          new Tools().toolsMethod)();//創(chuàng)建并調(diào)用 
              }


              
          }

           

          或者其它更好的方法?

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

          JDBC驅(qū)動(dòng)程序

          JDBC通過(guò)一系列接口來(lái)訪問(wèn)數(shù)據(jù)庫(kù),而這些接口的實(shí)現(xiàn)則是由不同的數(shù)據(jù)庫(kù)廠商或組織實(shí)現(xiàn)的。要實(shí)現(xiàn)對(duì)某一特定類型數(shù)據(jù)庫(kù)的訪問(wèn)就要通過(guò)注冊(cè)JDBC驅(qū)動(dòng)程序來(lái)讓程序知道去哪里調(diào)用JDBC API 接口的實(shí)現(xiàn)。

          先看下面的一段程序:

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

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

          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 閱讀(722) | 評(píng)論 (0)編輯 收藏

          僅列出標(biāo)題
          共4頁(yè): 上一頁(yè) 1 2 3 4 下一頁(yè) 
          主站蜘蛛池模板: 金溪县| 邯郸县| 正宁县| 澄城县| 平湖市| 张家港市| 安吉县| 长沙县| 进贤县| 十堰市| 忻州市| 扬中市| 连山| 永胜县| 五华县| 辽宁省| 商都县| 和田县| 阳东县| 陈巴尔虎旗| 余干县| 佛坪县| 阳信县| 额敏县| 永修县| 大荔县| 五寨县| 松溪县| 白玉县| 游戏| 遂昌县| 郸城县| 扶沟县| 眉山市| 奉节县| 合川市| 东平县| 邓州市| 吴川市| 婺源县| 呼和浩特市|