Hiya,
I have scoured the net for solutions to this, and have found little.
Perhaps I am missing something obvious but I was surprised because I thought this would be one of the most common things required in a
Struts app !
I'd like to have a number of radio input fields on a form, when the IDs and properties contain their respective numbers. Given that there will be a variable number of radios, I'd like to render them dynamically from a c:forEach tag (the jstl equivalent of logic:iterate).
My aproximate goal is :
<input type="radio" id="opt1" name="optRads" value="val1"/>
<input type="radio" id="opt2" name="opRads" value="val2"/>
<input type="radio" id="opt3" name="opRads" value="val3"/>
etc
This is my foiled attempt :
<c:forEach var='i' begin='1' end='3'>
<html:radio styleId="${i}RadioInput" property="opRads" value="val${i}"/>
</c:forEach>
I've surrounded the var i in ${} to highlight where I want the dynamic content.
The result of this and all my other efforts including the following :
<c:forEach var='i' begin='1' end='3'>
<html:radio styleId="<%=i%>RadioInput" property="opRads" value="val<%=i%>}"/>
</c:forEach>
seem to fail. Please help, anyone who knows this most esoteric mystery !
Anthony