I wanted to add a couple items to my description
of the transformations package - I don't think
it would be terribly clear for those who hadn't read my
original posting on it a while back.
The main purpose for creating the transformations package ("the itch")
was to be able to present data from business objects, and
be able to transform/format it for display without having to code
additional presentation bean wrapper classes.
Some examples of what you'd use this package for would be
to format a date object into a particular String form,
format a decimal number into a particular form, or sort a list
of orders for display in a particular order prior to displaying
them in a JSP page.
These tasks can be handled by using/coding transformations.
I've added functionality to a couple of the struts tags (via
subclassing) to support transformations. Specifically,
you can pass a "transformation" argument to a new beanx:write
tag that tells it what transformation to apply to the property
about to be displayed (e.g. to format a date into a particular
form). I've also added a couple arguments to the
IterateTag. The Iterate tag can take a transformation to
be applied as an argument. The transformation will be
applied to the collection being iterated over before
iteration starts. So the transformation can do things
like sort the collection in a particular order.
Currently, the following transformations are supported:
o Date transformation based on DateFormat & SimpleDateFormat
Has some internationalization support via locales
o Number transformation based on the NumberFormat class.
Has some internationalization support via locales
o Simple sorting transformation. Supports sorting an ArrayList
in ascending or descending order.
There's several things I see could be improved, including
better support for internationalization, if there's interest.