File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP Code to iterate Excel file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Code to iterate Excel file" Watch "JSP Code to iterate Excel file" New topic

JSP Code to iterate Excel file

Bhaskar Chandrasekaran

Joined: Mar 15, 2013
Posts: 4
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

Joined: Mar 22, 2005
Posts: 42965
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).
I agree. Here's the link:
subject: JSP Code to iterate Excel file
It's not a secret anymore!