• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

logic:iterate tag displaying same results??

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello all

I'm fairly new to struts and i'm having this problem with logic:iterate tag please help!!

I have this in my JSP



This is in my Action Class



My ActionForm bean UserForm has a getter and setter method


The output I have in JSP are
2 user_account_2
2 user_account_2

but it should be
1 user_account_1
2 user_account_2

Any ideas?
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are putting the same object into your collection twice. It should look like this:


[ June 05, 2006: Message edited by: Dom Lassy ]
 
Mona Tajik
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh ok now I get it. Thanks a lot for the immediate response
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
even this should work.

Vector user_info = new Vector();
UserForm userForm = new UserForm(); //ActionForm bean
userForm.setId("1");
userForm.setDesc("user_account_1");
user_info.addElement(userForm);
userForm.setId("2");
userForm.setDesc("user_account_2");
user_info.addElement(userForm);
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic