Looping through javabean array in jsp?

Posted on 2006-05-07
Medium Priority
Last Modified: 2008-02-01

In my servlet, I created an ArrayList of objects and pass these to a jsp page using:

req.setAttribute("bean", uploadList);

The ArrayList contains objects of the FileBean class, with a getIndex, and getDate methods.

Could any possibly demonstrate how to loop through the ArrayList in the jsp and display the FileBean object values in a html table?

To display the values of a javabean in jsp pages I normally have to use for example. requestScope.bean.getMethod();


Question by:EmailSurfer
1 Comment
LVL 11

Accepted Solution

fargo earned 220 total points
ID: 16626456
// get the list from the request
ArrayList upList = (ArrayList) request.getAttribute("bean");
...heading for the table
for(int i=0;i<upList.size();i++){
FileBean row = (FileBean)upList.get(i);
<%= row.getIndex()%>
<%= row.getDate()%>

i haven't tested the above code. But that should work. Moreover, if u are using struts it is much easy of using logic iterate tag.

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Tech giants such as Amazon and Google have sold Alexa and Echo to such an extent that they have become household names. And soon they are expected to be used by commoners in their homes, ordering takeout, picking out a song, answering trivia questio…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question