This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
And my response was good question! What I am trying to do is place data in a table. The data is stored in an ArrayList, and each object in the ArrayList has 5 fields that need to be placed in their own cell in the object's own row of the table. Since the ArrayList is being retreived from the servlet code as an attribute, I can't figure out how to take the logic that iterates through each item in the ArrayList and prints the data stored in each field in the appropriate cell of the table out of the jsp. It seems to me that the scriptlet I'm using to iterate through the ArrayList has to be in the jsp, because the ArrayList itself is being passed as as attribute. The iteration logic is needed in order for the expression that follows to be able to print each item out to the table. If I move this logic to the servlet, how can I provide the individual pieces of data to the table in the jsp?
Originally posted by Carol Murphy: ... the ArrayList itself is being passed as as attribute. ... If I move this logic to the servlet, how can I provide the individual pieces of data to the table in the jsp?
What if you put the individual pieces into the ArrayList before you pass the list as an attribues?
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joined: Mar 15, 2001
So instead of setting the ArrayList of video objects as the attribute, do all of the iterating first, put that in an ArrayList and set that to an attribute? Hmmmmmm. Or would ArrayList be the right thing to use? Must research collections some more....