This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes Servlets 4a question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Servlets 4a question" Watch "Servlets 4a question" New topic
Author

Servlets 4a question

Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1194
Got this nitpick:

Any way to get this logic stuff out of the jsp?

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?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
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
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1194
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....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlets 4a question
 
Similar Threads
Submit buttons within table rows...
annoying expression
Okay, but......
Getting parameters/attributes
Using attributes