Reprint from: http://hi.baidu.com/ljzcome/blog/item/b33c38908d696b88a977a4c9.html
Use Apache Commons-fileupload.jar implementation file upload 2008-04-18 01:09
Reference address: Http://commons.apache.org/fileupload Use FileUpload Depending on your application requirements, FileUpload can be used in many different ways. In the simplest case, you can call an easy way to parse the servlet re
* Java. lang. string * Java. SQL. date * Java. SQL. time * Java. SQL. timestampNote that Java. util. date is not supported, and its subclass java. SQL. date is supported. Therefore, if the object contains time-type attributes and you want to convert them, you must use the java. SQL. date type. Otherwise, an argument mistype exception occurs during conversion.Iii. Advantages and Disadvantages:The Apache Jakarta Co
Use APACHE-commons-fileupload to write a JSP file to be uploaded
You need to download the fileupload and beanutils packages. The Code is as follows.
String mkdir (string path ){
String MSG = NULL;Java. Io. File dir;
// Create a file objectDir = new java. Io. File (PATH );If (DIR = NULL ){MSG = "error cause: Return MSG;}If (dir. isfile ()){MSG = "error cause: Return MSG;}If (! Dir. exists
Because the FTP operation is needed in the recent work, and there is no existing FTP code on hand. Went online to find a bit, found that everyone using Apache Commons-net Library in the ftpclient.However, the feeling is not very convenient to use. And found a lot of packages on the Internet. I think it's not very useful. So I wrote one of my own. Most of the examples on the web are directly manipulating fil
(P.getcolumndimension ());//2//Invert p, using LudecompositionRealmatrix Pinverse =newludecomposition (P). Getsolver (). Getinverse (); System. out. println (Pinverse); The result of the operation is as follows: min:0.27333Max:1.33mean:0.46269083333333333Product:2.3429343978460972E-5sum:5.552289999999999Variance:0.08757300031742428 thePercentile value:0.5674000000000001geometric mean:0.4112886050879374skewness:2.670095445623868kurtosis:7.718241303328169Sumofsquares:3.5322966905000004standarddev
Beanlisthandler to implement converting all rows of resultset to the list of person JavaBeans resultsethandler3.3 CustomRowprocessoreach of the provided The Resultsethandler implementation receives a rowprocessor to do the actual conversion of the row-to-object. The default processor is implemented using Basicrowprocessor, but you can implement a custom version of the plugin. Perhaps the most common customization is to implement the Tobean () method to handle custom database data type issues. 3
(command);Executing the bodyDefaultexecutorexec = new Defaultexecutor ();Exec.setexitvalues (NULL);Using a watchdog to set timeoutsExecutewatchdogwatchdog = new Executewatchdog (60000);Exec.setwatchdog (watchdog);Pumpstreamhandlerstreamhandler = new Pumpstreamhandler (Outputstream,errorstream);Exec.setstreamhandler (Streamhandler);Exec.execute (commandline);//executionStringout = outputstream.tostring ("GBK");Stringerror = errorstream.tostring ("GBK");System.out.println (out);SYSTEM.ERR.PRINTLN
Collectionutils provides many ways to manipulate collections , and the common methods are as follows importorg.apache.commons.collections.collectionutils;importjava.util.arraylist;import java.util.list;publicclasscollectionutilstest{public Staticvoidmain (String[]args) {List Apache Commons Collections Collectionutils Tool class simple to use
Org. apache. commons. fileupload. FileUploadBase $ InvalidContentTypeException, apachecommons
1. Error cause
org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is nullat org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.
2. Error cause
3. Solution
When non-built-in objects such as java. SQL. Date are used, this exception occurs if the object is null. The simplest method is to ensure that non-built-in objects are not null.
As the demand changes in the project business, there is no guarantee that the built-in objects are not null. Therefore, it is necessary to solve this exception to achieve a general effect. The following is a solution to this exception:
/** Time to market */Private java. SQL. Date timeToMarket;
// If timeToMarket is null
With Apache Commons-net-3.0.1.jar and Log4j-1.2.15.jar, this is a jar bag.
packagecom.bjut.edu.cn.ftp; importjava.io.bufferedinputstream; importjava.io.bufferedoutputstream; importjava.io.file; import java.io.fileinputstream; importjava.io.filenotfoundexception; import java.io.fileoutputstream; importjava.io.ioexception; import java.util.timezone; importorg.apache.commons.net.ftp.ftpclient; import org.ap
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.