Dynamic radio buttons matrix using Struts

  • Thread starter Antonietta Tobito via JavaKB.com
  • Start date
A

Antonietta Tobito via JavaKB.com

Hello, I?ve a problem, please if somebody could help me I?ll really
appreciate it.

I have a dynamic matrix with radio buttons, only the number of rows could
change. The matrix is as follows, it has 4 static columns of radio buttons
and for each row I can select only one (radio button):

Skill 1 O O O O
Skill 2 O O O O
Skill 3 O O O O
Skill n O O O O

How could I store the selected radio buttons in the ActionForm? Whichever
information you have that it could help me, I?d really appreciate it.
 
K

KevinHanna

Each column would have an array:

Integer[] col1s;
Integer[] col2s'
....

In your JSP:
<html:form...>
Loop
<html:multibox property="col1s" value="${skill.number}"/>
End Loop
Where skil.number resloves to something unique for that skill/row
 
W

Wendy S

Antonietta Tobito via JavaKB.com said:
I have a dynamic matrix with radio buttons, only the number of rows could
change. The matrix is as follows, it has 4 static columns of radio buttons
and for each row I can select only one (radio button):

Skill 1 O O O O
Skill 2 O O O O
Skill 3 O O O O
Skill n O O O O

How could I store the selected radio buttons in the ActionForm? Whichever
information you have that it could help me, I?d really appreciate it.

It depends on what the data is, and what you want to do with it. In the
simplest case, a String[] should work.

I can also see an array of Skill objects. Each Skill has a description and
(what are the columns? maybe) a level. I'd like to know more about the form
first.

This really isn't a matrix since you only allow one selection per row. (If
it were checkboxes instead of radio buttons, then you'd need a
two-dimensional structure.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top