Looping through javabean array in jsp?

Posted on 2006-05-07
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

    // 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

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    This post first appeared at Oracleinaction  ( Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now