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>









Related Tutorials/Questions & Answers:
How to Get The Data from Excel sheet into out jsp page???
How to get data from Excel sheet - Struts
Advertisements
How to export data from jsp to excel sheet by using java
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 export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java
how to read values from excel sheet and compare with database using jsp
export data to excel sheet - JSP-Servlet
extract data from excel sheet to mysql
How to export data from database to excel sheet by using java in standalone project
read excel data from jsp - JSP-Servlet
Hi how to transfer table data from html page to excel sheet by using javascript .
excel sheet reading and using that data - JSP-Servlet
Read code from excel sheet and upload into database using JSP
Uploading Excel sheet record in JSP to insert data in MySql
Store data in HTML forms from Excel sheet
update excel sheet using jsp::
export data from database to excel sheet - JDBC
Convert the excel sheet data into oracle table through java or jsp
How to export data from database to excel sheet by using java swing in standalone project - Java Beginners
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 checkboxes - JSP-Servlet
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp
Export data to Excel Sheet in STRUTS 1.3
how to display the data from excel to webpage
How to save data to excel with a 2.1 work sheet format without changing it?
Export data in excel sheet in java in struts - Struts
Read data from excel file and update database using jsp
How to get data from DB in to Text box by using Jsp & Ajax
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
How Can I get ArrayList of Data from jsp with ajax request
How to read every cell of an excel sheet using Apache POI and insert those data into a DB?
How to get the data from the database using Servlet or JSP program
jsp data in excel - JSP-Servlet
exporting data to excel sheet - JDBC
How to get data from Oracle database using JSP
Need to Remove Duplicate Records from Excel Sheet
how to get a column values from a excel file after attaching it - JSP-Servlet
how to get a values from a multipart/form-data - JSP-Servlet
Printing data into Excel sheet - Java Beginners
Reading the Date and time values from excel sheet
How to Create New Excel Sheet Using JSP
insert rows from Excel sheet into a database by browsing the file
Retrieving specific data from excel
Create Bar Graph from reading excel sheet in Java

Ads