<html>
<head>
<script type="text/javascript">
function addOption(dropdown,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
dropdown.options.add(optn);
}
</script>
</head>
<select id="year" name="year" style="width: 70px" ></select>
<script type="text/javascript">
var date = new Date();
var startYear = '2000' ;
var currentYear = date.getFullYear();
do
{
addOption(document.getElementById("year"), currentYear, currentYear);
currentYear--;
}
while (currentYear >= startYear);
</script>
</BODY>
</html>
This blog demonstrate how to upload data from file to remote server/database. Follow the steps as shown. 1. Create new Dynamic Web Project. 2. Now create all the packages as show in the image below. 3. Create controller with name ImportContact.java 4. Create pojo with name Contact.java 5. Create database layer code with name ImportContactBroker.java 6. Create connectivity with name DBConnection.java 7. Create db connectivity setting file as connectionSetting.java 8. Create jsp page with importcontact.jsp 9. Create supporting files like Constant.java and CsvReader.java 10. You can download the war file and import in your workspace. 11. MultipartRequest in Servlet and inside jsp helps to upload file on the remote server. 12. Download sample csv file from here . 13. Create Table with name Contact in Database as given in configuration file. 14.Just compile and run the code. ImportContact.java package com.uploadfile.controller; import java.io.BufferedReader; impo...
Comments
Post a Comment