Long time no update blog, wrote a JSP upload components to see you
1. Download down, create a new Java EE project, put the Qingcai-upload.jar into the Lib, and then Upload.tld put under the Web-inf.
2. In Web.xml
For example:
<?xml version= "1.0" encoding= "UTF-8"?>
<web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xmlns= "Http://java.sun.com/xml/ns/javaee" xmlns:web= "http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"
xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"
Id= "webapp_id" version= "2.4" >
<display-name>aa</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/upload</taglib-uri>
<taglib-location>/WEB-INF/upload.tld</taglib-location>
</taglib>
<servlet>
<servlet-name>UploadServlet</servlet-name>
<servlet-class>com.qingcai.upload.servlet.UploadServlet</servlet-class>
<init-param>
<param-name>savePath</param-name>
<param-value>C:\\upload\\</param-value>
</init-param>
<init-param>
<param-name>extension</param-name>
<param-value>gif,rar</param-value>
</init-param>
<init-param>
<param-name>maxFileSize</param-name>
<param-value>20</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>UploadServlet</servlet-name>
<url-pattern>/fileupload</url-pattern>
</servlet-mapping>
</web-app>
3. Create a new JSP
Such as
<%@ page language="java" contentType="text/html; charset=GBK"
pageEncoding="GBK"%>
<%@ taglib uri="/upload" prefix="qingcaiUpload"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>Insert title here</title>
<body>
<qingcaiUpload:upload/>
</body>
This will allow you to call the
This is the most basic upload, I will be in the past few days to do more perfect points, and then will be issued to the code, together to study, explore together.
This article supporting source code