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

Ads
 

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 get data from Excel sheet - Struts
Advertisements
How to export data from jsp to excel sheet by using java
how to display data in excel sheet?
read data from Excel sheet
How to export data from html to excel sheet by using java
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
jsp with excel sheet data uploading into database
how to read values from excel sheet and compare with database using jsp
export data to excel sheet - JSP-Servlet
How to export data from database to excel sheet by using java in standalone project
extract data from excel sheet to mysql
Hi how to transfer table data from html page to excel sheet by using javascript .
how to get data from list to map with out using a loop?
Store data in HTML forms from Excel sheet
How to export data from database to excel sheet by using java swing in standalone project - Java Beginners
read excel data from jsp - JSP-Servlet
excel sheet reading and using that data - JSP-Servlet
export data from database to excel sheet - JDBC
Uploading Excel sheet record in JSP to insert data in MySql
update excel sheet using jsp::
Read code from excel sheet and upload into database using 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
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 DB in to Text box by using Jsp & Ajax
how to display the data from excel to webpage
How Can I get ArrayList of Data from jsp with ajax request

Ads