previous | index | next

Storing Tag Attribute Values in the Tag's Component

Recall that component classes get attribute values by accessing an attribute map, for example:
   Integer minimum = (Integer) component.getAttributes().get("minimum");
Tag handler classes must provide for copying attribute values to the component through the setProperties method:
public class SpinnerTag extends UIComponentELTag {
   ...
   public void setProperties(UIComponent component) {
      // always call the superclass method
      super.setProperties(component);
      component.setValueExpression("size", size);
      component.setValueExpression("minimum", minimum);
      component.setValueExpression("maximum", maximum);
      component.setValueExpression("value", value);
   }
   ...
}
This method is misnamed because it sets attributes, not properties.

previous | index | next