Skip to content
Advertisement

How to get s:radio with label content as empty

I am using the struts tag s:radio as below;

<s:radio list="radioOptions" name="answer%%{#ques.pageNbr}%%{#ques.seqNbr}" value="defaultAnswer" />

That is generating the HTML output as below;

<input type="radio" name="answer11" id="answer11Yes" value="Yes"/><label for="answer11Yes">Yes</label>
<input type="radio" name="answer11" id="answer11No" value="No"/><label for="answer11No">No</label>

However I don’t want the label content like Yes or No. I am loading an image instead of that. How can I make that label content as blank or null?

Advertisement

Answer

Use a map to populate a radio tag. The value of the map is used as a label, the key is used as a value.

<s:radio name="answer%%{#ques.pageNbr}%%{#ques.seqNbr}" list="#@java.util.HashMap@{'Yes':'','No':''}" />

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement