• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Servlets 4a question  RSS feed

 
village idiot
Bartender
Posts: 1214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 9087
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Carol Murphy
village idiot
Bartender
Posts: 1214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!