The following jsp file fragment using struts2 tags doesn’t show the textfield label. How can I fix this? Is it possible to have the label displayed by using only struts2 tags?
<s:form action="voucher" theme="simple">
<table width=50% border="5">
<tr>
<td>
<s:textfield label="Enter the voucher hrn" name="voucher.SN" />
</td>
<td>
<s:submit value="Check state" />
</td>
</tr>
<tr>
<td>
<s:radio list="#{'used': 'Mark as used', 'available': 'Mark as available'}" name="selections" value="%{'used'}"></s:radio>
</td>
<td>
<s:submit value="Update state" />
</td>
</tr>
</table>
</s:form>
It is because you are using
simpletheme in your form. Removetheme="simple"from<s:form>tag then Struts2 will do table layout as well field errors and labels for you.BTW if you really need to use your custom layout then use
<s:label>tags for labels.