struts2 html checkbox not pre-checked

    <body>
    <h3>Register for a prize by completing this form.</h3>
    <s:form action="register">
          <s:textfield name="personBean.firstName" label="First name" />
          <s:textfield  name="personBean.lastName" label="Last name" />
          <s:textfield name="personBean.email"  label ="Email"/>
          <s:textfield name="personBean.age"  label="Age"  />
          <input type="checkbox" checked="checked" />
          <s:submit/>
    </s:form>
    <input type="checkbox" checked="checked" />
    </body>

I have a jsp with above content. The checkbox within the form is not checked whereas the checkbox outside form is pre-checked. I am mixing up plain html checkbox and non-html elements within a struts form.


Source: jsp

Leave a Reply