• 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

struts 2 checkbox

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am having an issue with struts 2 checkboxes vs html checkboxes

here is what an html checkbox does:
<input type="checkbox" name="checked" value="sam"/>
<input type="checkbox" name="checked" value="john"/>
<input type="checkbox" name="checked" value="paul"/>

which gives you an array of strings[].

but i want to use the value out of an iterator
<s:iterator value="people" status="stat">
<s:checkbox theme="simple" name="checked" value="%{userid}" />
</s:iterator>

unfortuneately, this only returns me an array trues.

does anyone know how I can get the value of userids, instead of true?

Thanks.
Charlene
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:

Note that there is no need to put this inside an <s:iterator> tag as it does its own iteration over the list.

If you still want to use <s:checkbox>, specify fieldValue="%{userid}" instead of value="%{userid}".
[ September 13, 2007: Message edited by: Merrill Higginson ]
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic