"Harris, Andrew S" wrote:
> A component would be able to hold a text value and a data value. The text
> value could hold the value entered by the user, prior to validation, then
> this could be played back to the user if validation failed on that
> component. If validation succeeded, the data value would be updated, then
> the text value would be replaced by the formatted value, using the data
> value and the formatter.

This is a good design pattern, and one we can use with Struts today. In
the ActionForm bean, define two properties, one for the text value and
one for the data value. If validation succeeds, convert the text value
to the data value, and (optionally) update the text value to match your
preferred formatting. 

Though, with a general conversion/transformation package, we would
really only need to store the desired data value since we could
transform it again later when the value was accessed for presentation,
perhaps via a bean:writeTransform tag.


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/

Reply via email to