Struts Indexed Properties

S

servlette

Hi,
Can anyone send me a complete code snippet for designing the form bean
and the JSP to get radio button values dynamically from the JSP page.

I have 4 radio buttons followed by a user name.

For every user name, there are 4 radio buttons and the no of users is
dynamic and they get populated from the database.

A B C D
U1 O O O O
U2 O O O O
U3 O O O O
U4 O O O O
----
----
Ux O O O O


For each user, I have a unique user id. Assume that for U1 user id is 1
and so on.

I may select any of the radio button option for every user.

Suppose I get radio button A for U1 and U23 and U57, then I should
populate the user ids for "A" in an int[] array in the form bean so
thata in the action class, I can get these values like.

int a[]= formBean.getA();
int b[]=formBean.getB();
int c[]=formBean.getC();
int d[]= formBean.getD();

I am not using struts tags in the JSP and what I use is JSTL.
But I want to retrieve the user ids as an int array in the action
class.

Please tell me how should I design <input type="radio"> in the JSP page
so that Struts form beans understands the JSP page as if this page got
generated by Struts nested tags. Whatever options (JSTL or Struts
nested tags), the end result is a simple HTML page and form beans read
the values from HTML!

I can hard-code or dynamically set the "name" attribute or "id"
attribute in <input type="radio"> tag so that form bean understands it
and populates the user id in the int[] array for all 4 radio A, B, C
and D.

Thanks and regards,
 

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,770
Messages
2,569,584
Members
45,076
Latest member
OrderKetoBeez

Latest Threads

Top