Lista de ligação de mola <Object> no formulário: caixas de seleção

Não consigo obter meu formulário vinculado ao controle de caixas de seleção. Eu li muitos posts aqui e tentei algumas técnicas, mas sem sorte. Talvez um novo par de olhos ajude.

my controller:

public String editAccount(@RequestParam("id") String id, Model model) {
    model.addAttribute("account", accountService.getAccount(id));
    model.addAttribute("allRoles", roleService.getRoles());
    return EDIT_ACCOUNT;
}

my jsp:

<form:form action="" modelAttribute="account">
<form:checkboxes items="${allRoles}" path="roles" itemLabel="name" itemValue="id" delimiter="<br/>"/>
</form>

o html gerado:

<span><input id="roles1" name="roles" type="checkbox" value="1"/><label for="roles1">User</label></span><span><br/><input id="roles2" name="roles" type="checkbox" value="2"/><label for="roles2">Admin</label></span><span><br/><input id="roles3" name="roles" type="checkbox" value="3"/><label for="roles3">SuperAdmin</label></span<input type="hidden" name="_roles" value="on"/>

Usei um segundo para cada loop (não mostrado) para garantir que o objeto do modelo contivesse as funções. Sim, mas nenhuma das caixas de seleção está marcada e quando eu envio o objeto de funções está sempre vazio. Alguém pode me dizer o que estou perdendo?

Obrigad

EDITA

Desculpe, acabei de perceber que pode ser útil ver os objetos de conta e função:

public class Account {

    private String username, firstName, lastName, email;
    private List<Role> roles;

    @NotNull
    @Size(min = 1, max = 50)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @NotNull
    @Size(min = 1, max = 50)
    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    @NotNull
    @Size(min = 1, max = 50)
    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    @NotNull
    @Size(min = 6, max = 50)
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }

    public String toString() {
        return ReflectionToStringBuilder.toString(this);
    }

}

public class Role {

private int id;
private String name;

public Role() {}

public Role(int id, String name) {
    this.id = id;
    this.name = name;
}

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

@NotNull
@Size(min = 1, max = 50)
public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

}

EDIT # 2

Controller Post Method

@RequestMapping(value = "edit", method = RequestMethod.POST)
public String updateAccount(@RequestParam("id") String id, @ModelAttribute("account") @Valid AccountEditForm form, BindingResult result) {
    System.out.println("FORM VALUES AFTER: " + form);
    return (result.hasErrors() ? EDIT_ACCOUNT : ACCOUNT_REDIRECT);
}

AccountEditForm é o objeto de backup do formulário. Quando faço um GET, pego um objeto Account e passo os valores para um AccountEditForm antes de exibir a tela. Anexarei o AccountEditForm apenas para maior clareza. É muito semelhante ao objeto de conta. Acabei separando meus objetos de formulário dos meus objetos de model

public class AccountEditForm {

    private String username, firstName, lastName, email;
    private List<Role> roles = new ArrayList<Role>();

    @NotNull
    @Size(min = 1, max = 50)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @NotNull
    @Size(min = 1, max = 50)
    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    @NotNull
    @Size(min = 1, max = 50)
    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    @NotNull
    @Size(min = 6, max = 50)
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }

    public String toString() {
        return ReflectionToStringBuilder.toString(this);
    }

}

ditor de Propriedade de Função @EDIT # 3

public class RolePropertyEditor extends PropertyEditorSupport {

    private Map<Integer, Role> roleMap = new HashMap<Integer, Role>();

    public RolePropertyEditor(List<Role> roleList) {
        for (Role r : roleList) roleMap.put(r.getId(), r);
    }

    public void setAsText(String incomingId) {
        Role role = roleMap.get(incomingId);
        System.out.println("PROPERTY EDITOR ROLE " + role);
        setValue(role);
    }

    public String getAsText() {
        System.out.println("PROPERTY EDITOR ID " + ((Role)getValue()).getId());
        return String.valueOf(((Role)getValue()).getId());
    }
}

Definido no meu controlador como:

@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.setAllowedFields(new String[] {
            "username", "password", "confirmPassword", "firstName", "lastName", "email", "acceptTerms", "currentPassword"
    });
    binder.registerCustomEditor(Role.class, new RolePropertyEditor(roleService.getRoles()));
}

EDIT # 4 NOVO ProeprtyEditor

public class SecurityRolePropertyEditor extends PropertyEditorSupport {

    private RoleService roleService;

    public SecurityRolePropertyEditor(RoleService roleService) {
        this.roleService = roleService;
    }

    public void setAsText(final String name) {
        Role role = roleService.getRoleByName(name);
        setValue(role);
    }
}

questionAnswers(2)

yourAnswerToTheQuestion