Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  

How to Get The Data from Excel sheet into out jsp page???



Share on Google+Share on Google+

How to Get The Data from Excel sheet into out jsp page???
1 Answer(s)      6 years and 2 months ago
Posted in : JSP-Servlet

How to Get The Data from excel sheet to out jsp page in webApp?

View Answers

June 24, 2011 at 2:56 PM

<[email protected] import="*"%>
<[email protected] import="java.util.*"%>
<[email protected] import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
<[email protected] import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
<[email protected] import="org.apache.poi.hssf.usermodel.HSSFRow"%>
<[email protected] import="org.apache.poi.hssf.usermodel.HSSFCell"%>
<table border="1">
 short a=0;
  short b=1;
  short c=2;
  short d=3;
  int i=0;
   String   value1="", value2="",value3=" ", value4="";
    String filename ="C:/hello.xls"; 
    if (filename != null && !filename.equals("")) {
    FileInputStream fs =new FileInputStream(filename);
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    for (int k = 0; k < wb.getNumberOfSheets(); k++){
    int j=i+1;
    HSSFSheet sheet = wb.getSheetAt(k);
    int rows  = sheet.getPhysicalNumberOfRows();
    for (int r = 0; r < rows; r++){
    HSSFRow row   = sheet.getRow(r);
    int     cells = row.getPhysicalNumberOfCells(); 
    HSSFCell cell1  = row.getCell(a);
      value1 = cell1.getStringCellValue();
      HSSFCell cell2  = row.getCell(b);
        value2 = cell2.getStringCellValue();
         HSSFCell cell3  = row.getCell(c);
         value3 = cell3.getStringCellValue();
          HSSFCell cell4  = row.getCell(d);
          value4 = cell4.getStringCellValue();
    catch(Exception e){


Related Tutorials/Questions & Answers: