Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Annotations > KeyProperty Annotation
Added by Rainer Hermanns, last edited by Don Brown on Nov 14, 2006  (view change)

Sets the KeyProperty for type conversion.

Usage

The KeyProperty annotation must be applied at field level.

This annotation should be used with Generic types, if the key property of the key element needs to be specified.

Parameters

Parameter Required Default Description
value no id The key property value.

Examples

// The key property for User objects within the users collection is the <code>userName</code> attribute.
@KeyProperty( value = "userName" )
protected List<User> users = null;