it doesn't solve my problem...... when i used it , it remove the error but didn't give desired output my copmlete code is given below
<%@page import="org.apache.poi.ss.usermodel.Cell"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.io.*"%>
<%@page import="java.util.regex.Matcher"%>
<%@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"%>
<form action="tab.jsp" method="get" enctype="multipart/form-data>
<div align="left">
<input type="file" name="F1" > <br>
<input type="submit" name="send">
<table border="1">
<% String rst=null;
try
{
String st=request.getParameter("mptest");
String o= Matcher.quoteReplacement("'\'");
rst= request.getRealPath(st);
rst = rst.replace("\\","\\\\");
out.println(rst);}
catch(Exception e)
{e.printStackTrace();}
int i=0;
String value1="";
double value2=0;
if(rst != null && !rst.equals(""))
{
try
{
FileInputStream fs =new FileInputStream(rst);
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);
%>
<tr>
<%
int cells = row.getPhysicalNumberOfCells();
for(int ce = 0; ce < cells; ce++)
{
HSSFCell cell1 = row.getCell(ce);
switch(cell1.getCellType())
{
case Cell.CELL_TYPE_STRING:
value1 = cell1.getStringCellValue();
%>
<td><%=value1%></td>
<%
break;
case Cell.CELL_TYPE_NUMERIC:
value2 = cell1.getNumericCellValue();
%>
<td><%=value2%></td>
<%
break;
}
%>
<%
}
%>
</tr>
<%
i++;
}
}
}
catch(Exception e){
System.out.println(e);
}
}
%>
</table>
</form>