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

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

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

View Answers

June 24, 2011 at 2:56 PM

<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFRow"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFCell"%>
<html>
<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("")) {
    try{
    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(); 
    out.write("<br>");
    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();
    %>
    <tr><td><%=value1%></td><td><%=value2%></td><td><%=value3%></td><td><%=value4%></td></tr>
    <%
    }
        i++;
    }
    }
    catch(Exception e){
        System.out.println(e);
    }
    }
    %>
    </table>
    </html>

Ads









Related Tutorials/Questions & Answers:
How to Get The Data from Excel sheet into out jsp page???
How to export data from jsp to excel sheet by using java
Advertisements
read data from Excel sheet
how to display data in excel sheet?
How to export data from html to excel sheet by using java
jsp with excel sheet data uploading into database
how to read values from excel sheet and compare with database using jsp
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java
extract data from excel sheet to mysql
How to export data from database to excel sheet by using java in standalone project
Hi how to transfer table data from html page to excel sheet by using javascript .
update excel sheet using jsp::
Read code from excel sheet and upload into database using JSP
Uploading Excel sheet record in JSP to insert data in MySql
excel sheet reading and using that data - JSP-Servlet
how to get data from database into dropdownlist in jsp
how to get data from list to map with out using a loop?
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp
Store data in HTML forms from Excel sheet
Convert the excel sheet data into oracle table through java or jsp
export data from database to excel sheet - JDBC
How Can I get ArrayList of Data from jsp with ajax request
How to get the data from the database using Servlet or JSP program
How to get data from Oracle database using JSP
how to get a column values from a excel file after attaching it - JSP-Servlet
how to display the data from excel to webpage
Export data to Excel Sheet in STRUTS 1.3
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
Read data from excel file and update database using jsp

Ads