Class StrutsMiscellaneousLibrary
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidformatForm(Object form) Formats the annotated form fields from the associated, unformatted halves of every formatted/unformatted field pair.static voidFor all the current Action's forms, formats the annotated, formatted halves of every formatted/unformatted field pair from the unformatted halves, except for any form that was retrieved and injected (usually a rejected form).Returns the formatted forms created byFormFormatterInterceptor.static voidupdateDisplay(Class<?> recordClass, Object record, Object display) Sets string fields ofdisplayfrom fields ofrecordwith the same name but formatted according to the conversion annotations ondisplayfields, or default converter if no annotation.
-
Constructor Details
-
StrutsMiscellaneousLibrary
public StrutsMiscellaneousLibrary()
-
-
Method Details
-
formatForm
Formats the annotated form fields from the associated, unformatted halves of every formatted/unformatted field pair. SeeBooleanConversion,EnumConversion,IntegerConversionetc.This is a legacy function and is called by view Struts Actions that don't use the
FormFormatterInterceptorinterceptor. -
formatForms
public static void formatForms()For all the current Action's forms, formats the annotated, formatted halves of every formatted/unformatted field pair from the unformatted halves, except for any form that was retrieved and injected (usually a rejected form). See
BooleanConversion,EnumConversion,IntegerConversionetc.This is a legacy function and is called by view Struts Actions that don't use the
FormFormatterInterceptorinterceptor. -
getFormattedForms
Returns the formatted forms created byFormFormatterInterceptor. As these are only created by a Struts 2 pre-result listener set by the Interceptor, no result is available till then. -
updateDisplay
Sets string fields of
displayfrom fields ofrecordwith the same name but formatted according to the conversion annotations ondisplayfields, or default converter if no annotation. Ifrecordis null, recipientdisplayfields are set according to the converter's formatting of null values (usually empty string). This function is useful for displaying database records.Miscellaneous notes.
- Source field type must apply to converter's type.
- Recipient field must be a string, not even string array or string collection.
- Custom converters only for formatting are best derived from
AbstractCustomFormatterSupportorAbstractCustomCollectionFormatterSupport. - The default converters for booleans and enumerations don't format to user friendly text, so custom converters are better.
- Does not follow associations.
-