Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data mismatch between two separate lists in a single iterator in struts2

 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hiii
iam having problem in struts2..
iam passing a list to iterator.
in iterator iam taking checkbox and a select list.
when iam selecting checkboxes am getting selected checkbox values in my action class. And in select tag iam getting all the values irrespective of checkbox selection.

my code is
http://pastebin.com/embed_js.php?i=Rcc9sMSs


Then my in my action i took

String[] user;
String[] placement;

for example if i check 3 checkboxes then
am getting user.length=3
and placement.length=5
so by this data mismatching
so please give me solution for this....

i think if i get total checked and unchecked values with true and false then my solution may be solved i think
Thanks alll in advance......
 
Jesus Mireles
Ranch Hand
Posts: 122
IntelliJ IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first thought was WTF

You are always overwriting the name with the last one. So to be honest I still dont know what your actual goal is ... but whatever it is I'm sure its not right because you are in an iterator and you keep using same names for both fields. So no matter what you do you'll always have the same values for all checkboxes and all select items .. and if I'm not mistaken it will always take the value of the last one maybe?

Anyway ... if you want more help you probably need to let us know what you are actually trying to accomplish ...
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply....
but iam taking String[] in action..
so iam getting all checked values in String[].

But i want all checked and unchecked values.
Its not overwriting iam getting all checked values in my String[].
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic