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 阅读(667) | 评论 (2)编辑 收藏

对委托事件模型中几个概念的理解:

  • 不同的操作,产生不同的事件类(Event),如窗口事件类WiondwEvent、单击事件类ActionEvent
  • 每个事件类有相对应的事件监听程序(Listener)(对事件对象的接收和处理)
  • 事件监听程序的声明在监听程序接口(Listener Interface)中,如 WindowListernerActionListener

传递及处理事件对象的流程

  • 注册对应事件的监听程序
  • 用某个类实现接口中的事件监听程序,即委托该类实现它的事件的监听程序
  • 运行时,系统将事件对象只传递给已注册的事件监听程序,并委托执行

posted @ 2005-03-05 23:50 bigseal 阅读(785) | 评论 (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 阅读(1049) | 评论 (0)编辑 收藏

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

posted @ 2005-03-03 20:30 bigseal 阅读(188) | 评论 (0)编辑 收藏

虽然把它的安装文件和源代码都download了,但却是一头雾水,没一点头绪。

今天问了一下,才知道是这样的:
jive实现了一个Jabber服务器,样只要使用jabber协议就可以和jive通信了,然后做了一安装程序把jelly 这个server 安装,然后将自己war发布到jelly,再加上了一个自己的启动脚本。

这只是一个大概的框架,虽然明白了它的基本构架,可具体的实现还是不明白,决定从读代码开始。既然不能从整体上把握,就一点一点的啃代码。

posted @ 2005-03-03 20:25 bigseal 阅读(419) | 评论 (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 阅读(187) | 评论 (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 阅读(20974) | 评论 (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 阅读(288) | 评论 (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 阅读(911) | 评论 (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 阅读(716) | 评论 (0)编辑 收藏

仅列出标题
共4页: 上一页 1 2 3 4 下一页