Apache Struts 2 Documentation > Home > FAQs > How do I populate my action properties upon validation failure
Added by tm_jee, last edited by Ted Husted on Jul 22, 2006  (view change) show comment

Populating the Action properties and validation are both handled by Interceptors. To ensure that the Action properties are populated regardless of whether validation passes or fails, in the Action's Interceptor Stack, ensure that the prepare} Interceptor comes before the {{validation Interceptor.

<saf:checkboxlist
 name="selectedOptions"
 list="options"
 listKey="id"
 listValue="name" />
public void prepare() throws Exception {
      // populate the options property list with options
      // that are supposed to be checked.
   }
The default stack does place the prepare Interceptor before the validation Inteceptor.