• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

2-dimentional array

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, people!
I have several select elements with multiple choise enabled. I need to create ActionForm that can get the 2-dimentional array (or a collection of collection) of selected values. Here is the sample code of my jsp:



<%= "permtype[" + index + "]"%> is the property where I have problem. I don't know how to declare it in ActionForm.
[ February 19, 2005: Message edited by: Konstantin Chikarev ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Konstantin,

In this case, you would code the <html:select> tag as follows:



Check out the documentation for more details on how the indexed property works.

http://struts.apache.org/userGuide/struts-html.html#select

Merrill
 
Konstantin Chikarev
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, I find the way to solve the problem myself. I use struts 1.2 so I don't need old usage of indexed property

equals
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi konstantin,
I have the same issue. I want to know how you solved it.
I have a iteration over a multiple select.
how can I get the values in my form? what should i have in my action form? String[][] or what?
 
Konstantin Chikarev
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check email.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi There,

My html source looks like this

<select name="screen[2].question[0].answer" multiple>
<option value="01">A1</option>
<option value="02">A2</option>
<option value="03">A3</option>
</select>

The screen , question and answer are array objects, but the selected values do not get populated in the answer array object, and I get

java.lang.IllegalArgumentException: argument type mismatch

I have the requisite getter setter methods. Any idea how to solve this

Regards
Zafer
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic