Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Code to iterate Excel file

 
Bhaskar Chandrasekaran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP code which will open the contents of a excel file.
Now i need this contents of the excel file to be added dynamically to a table in the sameJSP.Please let me know how to proceed.At the maximum 10 rows can be added dynamically.
Assuming i have a table in JSP which has heading first name,last name,DOB and Gender.After opening the excel through JSP the contents needs to be iterated and added to the columns mentioned.Can some one please help me?.

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

You would not do this in a JSP (which is purely for creating a view9; but in Java code - either a backing bean or a servlet. You can use the Apache POI library to do this. Then you would add everything the JSP page needs to a collection, which you can then iterate over on the JSP via JSTL.

Or you can use a tag library like DisplayTag to create the table (but you'd still use POI to read the file).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic