Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Struts 2 Iterate a List of Objects

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I have a List referenced in my model. A call to an action class populates this List in the model. Now, I would need to iterate this List in my JSP page. Below is what I've done in my JSP.



When I run my JSP page, I only see the Submit button displayed. Everything else is just not printed.

Am I correctly referencing the allExamsForTechnology in my iterator tag above? The allExamsForTechnology is a field in my Model which gets populated as a result of the action call.
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming you are getting proper data to bean, Try to access your bean directly as follows,

 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Data of course if fetched from the database. I get to see it in my action class. This is how my action class looks like:



The Model is as below:



I'm now trying to iterate over the allExamsForTechnology. I get to see the Submit button printed five times (I have 5 elements in my List). But I guess, I'm referring my properties wrongly in my struts iterator.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Allright, got it to work. There was a silly typo for a couple of properties in the Exam.java which is why it did not show anything.
reply
    Bookmark Topic Watch Topic
  • New Topic