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
Hi how to transfer table data from html page to excel sheet by using javascript .
read excel data from jsp - JSP-Servlet
update excel sheet using jsp::
excel sheet reading and using that data - JSP-Servlet
Uploading Excel sheet record in JSP to insert data in MySql
Read code from excel sheet and upload into database using JSP
how to get data from list to map with out using a loop?
Store data in HTML forms from Excel sheet
export data from database to excel sheet - JDBC
How to export data from database to excel sheet by using java swing in standalone project - Java Beginners
how to get data from checkboxes - JSP-Servlet
how to get data from database into dropdownlist in jsp
Convert the excel sheet data into oracle table through java or jsp
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp
How to get data from DB in to Text box by using Jsp & Ajax
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 display the data from excel to webpage
how to get a column values from a excel file after attaching it - JSP-Servlet
Export data to Excel Sheet in STRUTS 1.3
How to save data to excel with a 2.1 work sheet format without changing it?
how to get a values from a multipart/form-data - JSP-Servlet
Export data in excel sheet in java in struts - Struts
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
How to read every cell of an excel sheet using Apache POI and insert those data into a DB?
jsp data in excel - JSP-Servlet
JSP Get Data From Database
exporting data to excel sheet - JDBC
how to get a values from processRecord - JSP-Servlet
Need to Remove Duplicate Records from Excel Sheet
How to get the data from the database (Oracle) in console or in ie using servlet or jsp as Front end
How to Create New Excel Sheet Using JSP
Printing data into Excel sheet - Java Beginners
get values from Excel to database

Ads