I would appreciate any help here. I already spent a significant time on this problem. I tried several combinations of checkboxlist parameters.
The checkboxlist selected checkbox(es) are not checked as required. The checkboxlist is rendenderd correctly. However, when the form is submitted, and there is an error, I display the same page back. I am using a ModelDriven action (the Model is a ContactDTO bean class). Everything else is displayed, except the selected checkboxes are not checked as required. I have entries in resources files for the Enum values (RESIDENTIAL,,... ) below, and the corresponding resources language file is used correctly for the labels. Here are portions of relevant codes used: <s:checkboxlist name="categories.type" value="categories.type" list="categoryTypes" listValue="%{getText(toString())}" /> // this is the action the form post is submitted to. public final class AddContactAction extends BaseAction implements ModelDriven<ContactDTO> { private ContactDTO contactDto; public AddContactAction() { super(); this.contactDto = new ContactDTO(); } @Override public ContactDTO getModel() { return this.contactDto; } } // all actions derive from BaseAction which provides the list getter for the checkbox list. public abstract class BaseAction extends ActionSupport implements ServletRequestAware, ServletResponseAware, LocaleProvider { .... /** * @return the contactTypes used to populate drop down select lists */ // this is called fine by the struts 2. public Collection<CategoryType> getCategoryTypes() { return Arrays.asList(CategoryType.values()); } ... } public final class ContactDTO implements Comparator<ContactDTO> { private Collection<ContactCategory> categories; .... /** * @return the categories */ public Collection<ContactCategory> getCategories() { return categories; } /** * @param categories the categories to set */ public void setCategories(Collection<ContactCategory> categories) { this.categories = categories; } } @Entity @Table(name = "CONTACT_CATEGORY", schema = "EZLISTA") public class ContactCategory extends BaseEntity { ... @Enumerated(EnumType.STRING) @Column(name = "TYPE", nullable = false, length = 20) private CategoryType type; ... /** * @return the type */ public CategoryType getType() { return type; } /** * @param type the type to set */ // this method is being called by Struts 2 during a form post when the checkbox is selected. public void setType(CategoryType type) { this.type = type; } /** * @param type corresponding category type in text form */ public void setType(String inType) { if(! CategoryType.isType(inType)) throw new IllegalArgumentException("inType [" + inType + "] not valid."); CategoryType type = CategoryType.getEnum(inType); this.setType(type); } } public enum CategoryType { BUSINESS("BUSINESS"), FRIEND("FRIEND"), PERSONAL("PERSONAL"), PROFESSIONAL("PROFESSIONAL"), RELATIVE("RELATIVE"), OTHER("OTHER"); ... } -- Rubens Gomes www.rubens-gomes.com --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org