There are many sub-projects in the Apache Jakarta project. Commons focuses on providing a variety of common functions/classes.
You can use it in your own projects. These tools are so common that no matter which framework you use
Some of them can be used to save your coding workload, and the code quality is also very good.
Part of commons tools's starting point is to solve the various deficiencies in JDK:
1. exception is not easy to use, so you have to write a lot of try catch. Instead, you can use the C/C ++ commonly used to determine the result with the returned value. You can write less than many generations.
. JDBC interfaces are the most notorious in this regard.
2. Make up for the imperfections of the JDK class library. Such as string, Collection framework, and regular expressions.
I plan to write an article to introduce some of the things that I think are more common:
Codec includes hex, base64, URL encoding, and anti-decoding. It is very useful for Web applications.
Commons-collections enhances the collection framework function of JDK.
Commons-configuration read/write configuration parameters. Most programs place running parameters somewhere. This tool can read and write various parameter formats: databases, XML, properties files, system variables, and so on. Strong?
Commons-DBCP database connection pool. But there are also a lot of direct use of this. If you need to use a database to write a Java application, use this.
Dbutils can reduce the try catch for writing JDBC programs and reduce the amount of code. I want to write something that has never been written. But it is not as good as you think.
Send an email by email. The standard JDK library does not support sending emails, which is hard to understand.
Fileupload file upload. The J2EE standard library does not support file upload. These two features are basic for J2EE applications. A slightly larger system will be available.
I/O, Although JDK is called Io rewrite and NiO (new IO) package name is used, it is not good enough. This can be seen as an enhanced version.
Commons-lang. The lang package is the most basic package in Java. It is automatically imported by default, and the function is not strong enough to complete! This package is widely used in other systems, including WebLogic and websphere. Basically, any well-known java system will use it.
Commons-logging. Most EJB servers and tomcat use it. Most open-source Java projects also use it. Log abstraction layer. There are many types of logs in Java before. If you select a development program, you may want to change it later, which is troublesome. Using this tool to abstract one, it is easy to change. However, recently, log4j is an extremely large product. Few JDK logs are used. It seems that no one will change other logs.
Math. The math package in Java is barely enough. If you are a little biased towards the mathematical functions, you have to write them on your own. Use it to save time.
. Net to enhance Java Network functions. Java's Network Class Library is much different from the professional C ++ Network Class Library. It is better to enhance it here.
Commons-pool is a common object pool. It is not an EJB object pool. Pool, it is difficult to write well. The memory usage is not good, but the speed is slow (such as EJB ). In any case, it is a good idea and can be used for reference.
Validator: This is a good thing. Both web applications and common Java applications can be used as long as there is a user input interface. Easier to write than yourself. I do not agree to write it in XML. It is difficult to query one more letter and one less letter.
The Commons project also contains sandboxes, including cache, clazz, compress, convert, i18n, ID, Mapper, SQL, and threadpool, which are useful in many aspects. Ah, there are so many good things. How can I finish the introduction?
Let's take a look at an article. We hope you can support it.