Hi ,
i have to read data from excel .
i have created JSPDynpage component and followd below link :
http://help.sap.com/saphelp_sm40/helpdata/en/63/9c0e41a346ef6fe10000000a1550b0/frameset.htm
try
{
FileUpload fu = (FileUpload)
this.getComponentByName("myfileupload");
// this is the temporary file
if (fu != null) {
// Output to the console to see size and UI.
System.out.println(fu.getSize());
System.out.println(fu.getUI());
// Get file parameters and write it to the console
IFileParam fileParam = fu.getFile();
System.out.println(fileParam);
// Get the temporary file name
File f = fileParam.getFile();
String fileName = fileParam.getFileName();
// Get the selected file name and write ti to the console
ivSelectedFileName = fu.getFile().getSelectedFileName();
FileItem file = (FileItem) f;
InputStream is;
Workbook wb;
is = file.getInputStream();
wb = WorkbookFactory.create(is);
Sheet sheet = wb.getSheetAt(0);
int SheetCount = wb.getNumberOfSheets();
myLoc.errorT("#f.SheetCount()#"+SheetCount);
}
Error : java.lang.ClassCastException at line FileItem file = (FileItem) f;
Can anyone help me to resolve this issue?
Thanks,
Prasad.