Solving the Gender problem in the previous post..

..in other words, JSF Select Radio Button without tables using Tomahawk!

Documentation is here, kind of.

I will only include the changes. This is related to the problem mentioned in here.

I have a new dependency in pom.xml
<dependency>
    <groupId>org.apache.myfaces.tomahawk</groupId>
    <artifactId>tomahawk20</artifactId>
    <version>1.1.14</version>
</dependency>

I included this in the <h:head> section:
<style>
    #genderRadios > label:nth-child(2) {
        margin-top: -18px;
        margin-left: 18px;
    }
 
    #genderRadios > label:nth-child(4) {
        margin-top: -18px;
        margin-left: 18px;
    }
</style>

And here is the new Radio Button code for Gender:
<t:selectOneRadio id="gender"
                  value="#{student.gender}"
                  layout="spread">
    <f:selectItems value="#{student.genders}"/>
</t:selectOneRadio>
<t:div id="genderRadios">
    <t:radio id="maleRadio" for="gender" index="0"/>
    <t:radio for="gender" index="1"/>
</t:div>

And now even if the validation fails, Gender selection is not empty! Here is how the form looks:

All seems fine!