I have a create form in a jspx page. One of the fields in enum type.
I want to replace the select in the form with a radio button group.
It started with :
<field:select field="kyn" id="c_com_wop_fin_domain_Got_kyn" items="${kyns}" path="kyns" z="xxx="/>
I changed it to :
c:forEach var="enum" items="${gotkyns}" varStatus="pStatus">
<input type="radio" name="gotkyns" value="${gotkyns}">${gotkyns}</input>
</c:forEach>
I have two radio button but I would like to get the value of the enum in my radio buttons. How could I do that ?
My enum class looks like :
public enum GotKyn {
Hundur, Tyk
}
You could use
radiobutonorradiobuttonstags ( Spring View technologies)Import apropriate tag library and create data binding using
or
where
kynsValueshave to be populated inController. You pass in an Array, a List or a Map containing the available options in the “items” property ( Providing a link to data from the model with @ModelAttribute).