In this help topic you will learn how to create a simple Dynamic Web Application using the Eclipse IDE and the Apache Tomcat server implementing jqxFileUpload widget example in the Java environment.
In this help topic, we will be using Eclipse IDE for Java EE Developers, version Luna. You can get it from here: https://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunasr2. Run Eclipse and go to File → New → Dynamic Web Project. In the window that appears, type the project's name (we will name it "JqxFileUpload") and click Finish.
Several Java class packages (.jar
files) are necessary for the following
example and have to be included in the Java build path. These are:
commons-fileupload-1.3.1.jar
- The Commons FileUpload package makes it easy to add robust, high-performance, file upload capability to your servlets and web applications.
FileUpload parses HTTP requests which conform to RFC 1867, "Form-based File Upload in HTML". That is, if an HTTP request is submitted using the POST method, and with a content type of "multipart/form-data", then FileUpload can parse that request, and make the results available in a manner easily used by the caller.commons-io-2.4.jar
- Commons io library is required by the commons-fileupload library to work.Here is how to add these to the Eclipse project:
The added JARs should appear in Java Resources\Libraries
and be ready
for use:
Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. We will be using Tomcat 8.0 in this tutorial. If you do not already have Apache Tomcat on your system, download it from here: http://tomcat.apache.org/download-80.cgi and install it. Then:
commons-fileupload-1.3.1.jar
commons-io-2.4.jar
Create two folders in the project folder WebContent
- js
and css
. Include in them all (or only the necessary) jQWidgets files
- the scripts (including jqxcore.js
and the specific widget files
jqxbuttons.js and jqxFileUpload.js) in js
and the stylesheets
(jqx.base.css
and any themes and associated images) in css
. Remember to include a version of jQuery in js
, too.
.jsp
file. We'll call it index.jspNote: the uploadUrl parameter is pointing to the value specified for <url-pattern> in web.xml in the <servlet-mapping> section.