怎样Commons-commons fileupload...

This tutorial is about how to implement file upload functionality with Spring MVC framework. To handle file uploads, Spring provides a MultipartResolver bean which is responsible for resolving multipart request. This resolver is working with two file upload libraries: &: The bean class is org.springframework.monsMultipartResolver (com.oreilly.servlet): The bean class is org.springframework.web.multipart.cos.CosMultipartResolver & We need to declare the MultipartResolver bean in Spring’s context file as follows: & For CommonsMultipartResolver: &&bean id="multipartResolver"
class="org.springframework.monsMultipartResolver"&
&!-- max file size in bytes --&
&property name="maxUploadSize" value="2000000" /&
&!-- other properties... --&
& &And for CosMultipartResolver:&bean id="multipartResolver"
class="org.springframework.web.multipart.cos.CosMultipartResolver"&
&!-- max file size in bytes --&
&property name="maxUploadSize" value="2000000" /&
&!-- other properties... --&
Also we need to add to classpath jar files of the file upload library employed:For Apache Commons File Upload: commons-fileupload-VERSION.jar and commons-io-VERSION.jar (Commons File Upload depends on Commons IO).For COS: cos.jar As Apache Commons File Upload is popular and preferred over COS, this tutorial will use it. We will build a Spring MVC application which has an upload form looks like in the following screenshot:
& This tutorial requires the following pieces of software installed on your computer (click on a link to download the corresponding software): (required by Spring) & &PrevAttachments:[Deployable WAR file]3540 kB[Eclipse project]3542 kB
Add comment
What's the error?
JavaScript is currently disabled.Please enable it for a better experience of .2010年5月 Java大版内专家分月排行榜第一2010年2月 Java大版内专家分月排行榜第一2010年1月 Java大版内专家分月排行榜第一2010年1月 Oracle大版内专家分月排行榜第一2009年12月 Java大版内专家分月排行榜第一2009年12月 Oracle大版内专家分月排行榜第一
2010年2月 Oracle大版内专家分月排行榜第三
2010年2月 Java大版内专家分月排行榜第二
2011年7月 Java大版内专家分月排行榜第三2010年1月 Java大版内专家分月排行榜第三2009年12月 Java大版内专家分月排行榜第三
本帖子已过去太久远了,不再提供回复功能。

参考资料

 

随机推荐