File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes  Data mismatch between two separate lists in a single iterator in struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark " Data mismatch between two separate lists in a single iterator in struts2" Watch " Data mismatch between two separate lists in a single iterator in struts2" New topic
Author

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

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

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......


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

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

Joined: Aug 01, 2007
Posts: 485

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[].
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data mismatch between two separate lists in a single iterator in struts2