JSP Ajax upload Tag original version

Source: Internet
Author: User
Tags xmlns tld

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

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.