Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Reading excel via JSP

Have Programming Question? Ask it here!
 
 
 


Gopinath Ashokan
Reading excel via JSP
1 Answer(s)      a year and 7 months ago
Posted in : JSP-Servlet


The problem is while reading cells values which all are having "space" between the word, I can read only till space after that space the word has been dropped.

for Example  
Name                 CareerStart
gopinath Ashokan     December 2005

after read 
Name         CareerStart
gopinath     December 

can you help me in that and tell me how to ignore the space between words and get full cell value? I am reading the value as follows


HSSFCell cell2 = row.getCell(1);
if (cell2 != null) {                            
switch (cell2.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC:name = ""+ cell2.getNumericCellValue();     
break;  
case HSSFCell.CELL_TYPE_STRING:name = cell2.getStringCellValue();
break;  
}   
}
HSSFCell cell5 = row.getCell(4);
if (cell5 != null) {
switch (cell5.getCellType()) 
{   
case HSSFCell.CELL_TYPE_NUMERIC:CareerStart = ""+ cell5.getNumericCellValue();
break;
case HSSFCell.CELL_TYPE_STRING:CareerStart = cell5.getStringCellValue();
break;
}
}

<td><input type="text" name="name" value=<%=name%>></td>
<td><input type="text" name="CareerStart" value=<%=CareerStart%>></td>

anyone please help me to resolve that space issue(means while reading the cell values space should be ignored between the words)


Advertisement
View Answers

January 30, 2013 at 3:33 PM


Hi Team, I have found the solution for my question. The problem happended because I getting the values inside "text" field. So the "text" field taking the value after space as text field's "attribute value". To avoid this get the value as follows

<input type="text" name="name" value='<%=name%>'></td>
<input type="text" name="careerstart" value='<%=careerstart%>'></td>

Note: simply I have added single quotes for the value field in the "text".



Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com