• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic:iterate tag displaying same results??

 
Mona Tajik
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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?
 
Dom Lassy
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Oh ok now I get it. Thanks a lot for the immediate response
 
Manhar Puri
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • 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);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic