Hello Robert,

Monday, January 29, 2001, 11:27:32 PM, you wrote:

RQ> Doesn't this violate one of the behaviors of Struts forms?

RQ> If a Struts form is invalid, it is redisplayed to the user displaying the
RQ> values that the user actually entered.  Since the form bean is populated
RQ> using ConvertUtil, the bean my not contain the actual valued entered,
RQ> thus it cannot be redisplayed to the user as entered.

In my application I use scheme with string only fields and conversion
to/from data beans with error generation in case of String conversion
errors. We accumulate conversion errors and save it to errors
bean for another time showing to user. I can not view another way to
catch bad values in conversion process, because of Struts perfom this
conversion with 'default' values and 'zero123zero' string will be
converted to '0' without any problems...  Of course, I can test values
in validate method of ActionForm, but try to convert values in
validate and convert all stuff in ConvertUtils after that, sounds very
strange for me...

RQ> Seems to me that all form bean properties would have to be typeless 
RQ> (a String) in order to support the correct form behavior, which would suck.

Early released struts builds contains examples with such forms (String
only fields). Set/get methods perfom all needed conversions, but
already with default values in case of non valid values... 8)

RQ> What if the actual JavaBean spec compliant form bean was wrapped by some
RQ> sort of typeless dynamic proxy that would store the user entered value
RQ> and error message in the case of a conversion exception?  That would allow 
RQ> the form to redisplay the entered value while preserving the current 
RQ> automatic type conversion feature.

Interesting idea, for my mind... In this case any bean can be explaned
as form and wrapper will perfom all activity to convert to/from bean,
store errors, etc. Wrapper can described in any XML-like descriptor
and generated automatically. One thing here... Such 'hard' specification
for ActionForm classes is not so flexible to cover all situations.

-- 
Best regards,
 Oleg                            mailto:[EMAIL PROTECTED]


Reply via email to