I use the struts radio tag, which is populated with a list of objects that have two fields:
class MyAction { List<MyObject> myList; String selectedId public String execute() { ... myList = new ArrayList<MyObject>(); myList.add(new MyObject("1","first object"); myList.add(new MyObject("2","second object"); myList.add(new MyObject("3","second object"); ... }
Here is what I used on my page to display a list of radio buttons
<s:radio key="selectedId" list="myList" listKey="id" listValue="name"/>
However, this does give a horizontal list of switches. I tried adding css style to them:
<style> .vertical input { display: block; } </style>
But this leads to the fact that labels and radio buttons are displayed on separate lines, and not on the switch and label on the same line:
first object second object third object
I want:
first object second object third object
source share