Foren
RE: [SOLVED] Dynamically create radio buttons?
Michael Poznecki, geändert vor 14 Jahren.
[SOLVED] Dynamically create radio buttons?
Expert Beiträge: 301 Beitrittsdatum: 10.12.08 Neueste Beiträge
Hello all,
I am trying to create a unknown number of radio buttons on my struts jsp page.
Here is what I was trying:
But nothing shows up on my page. Can anyone help?
Thanks,
Michael
I am trying to create a unknown number of radio buttons on my struts jsp page.
Here is what I was trying:
Map<string,string> choices;
choices = new LinkedHashMap<string,string>();
String[] choices_data = {"AA", "BB", "CC", "DD", "EE", "FF", "GG" };
for (int i=1; i <= choices_data.length; ++i) {
choices.put(Integer.toString(i), choices_data[i-1]);
}
%>
<c:foreach var="item" items="${choices}">
<input type="radio" name="rb" value="${item.key}"> ${item.value}
</c:foreach>
</string,string></string,string>
But nothing shows up on my page. Can anyone help?
Thanks,
Michael
Michael Poznecki, geändert vor 14 Jahren.
RE: [SOLVED] Dynamically create radio buttons?
Expert Beiträge: 301 Beitrittsdatum: 10.12.08 Neueste Beiträge
Thanks to my good friend Albert J Carter-Corbin!!!
I just need to add this line of code to help with variable scope:
I just need to add this line of code to help with variable scope:
pageContext.setAttribute( "choices", choices );
Muhammad Asif, geändert vor 12 Jahren.
RE: [SOLVED] Dynamically create radio buttons?
Junior Member Beiträge: 25 Beitrittsdatum: 11.04.11 Neueste Beiträge
As you have worked with radio buttons, can you please tell how to place the radio buttons horizontally using <aui:input type="radio" /> tag. Thanks in advance.