• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
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......
 
Ranch Hand
Posts: 122
Mac IntelliJ IDE Java
  • 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[].
 
What's brown and sticky? ... a stick. Or a tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic