In this article, I am going to develop an application that shows how to upload files in JSP. This example consists of an HTML form, a JSP upload handler, a JSP processor for the uploaded files and another file containing resources.
Here we are going to develop an application showing how to upload files In JSP. To develop this application we use the following steps.
Step 1: Create a New Project.
In this step we select the New Project option from the file menu.
Step 2: Choose Project.
In this step we select a web application from the Java web option and then click on the next Button.
Step 3 : Name and Location.
In this step we give it a specific name and set a specific location and click on the next Button.
Step 4 : Server and Setting.
We select a specific server for this application and click on the next Button.
Step 5 : Select Framework.
There is no need to select any framework for this application; just click on the finish Button.
Step 6 : Create jsp file.
We create one jsp file for this application.
<TITLE>Uploading Files In JSP</TITLE>
<FORM ACTION="formAction.jsp" METHOD="POST">
<INPUT TYPE="FILE" NAME="filer">
<INPUT TYPE="SUBMIT" VALUE="Submit">
<TITLE>Uploading Files IN JSP</TITLE>
<H1>Uploading Files In JSP</H1>
<%= request.getParameter("filer") %>
Step 7: Compile and Run the application.
Now we compile the application and then run it on the server and find the following output.
First select the file through the browser and click on the submit Button.
Resources related to this article