Hello Martin,
With your example -
<form-bean name="AddressForm" validate="true">
<property name="street"/>
<property name="city" allowEmpty="false"
errorMessage="error.city.required"/>
<property name="zip" allowEmpty="false"
errorMessage="error.zip.required"/>
</form-bean>
Global error message -
<messages>
<errorMessage group="field.empty" key="error.field.blank"/>
</messages>
All fields (without errorMessage) such as it -
<property name="city" allowEmpty="false"/>
will be processed with message from list global messages.
Type -
<property name="ordernum" allowEmpty="false"
type="integer">
<errorMessage group="field.empty" key="error.city.required"/>
<errorMessage group="field.cast" key="error.number.conversion"/>
</property>
Global error message for casting -
<messages>
<errorMessage group="field.empty" key="error.field.blank"/>
<errorMessage group="field.cast.number" key="error.field.number.cast"/>
</messages>
All conversion operations with number properties will use global
message to generate error message in case of wrong conversion.
Friday, January 12, 2001, 7:54:44 AM, you wrote:
MC> Oleg,
MC> You mentioned four additions:
MC> - type
MC> - global error message for missing properties
MC> - error message for conversion error with property
MC> - global error message for properties of some type
MC> I understand the first one (type). There, I was just being lazy, since all
MC> my properties are Strings. :-)
MC> Can you help me understand what you mean by the other three?
MC> Thanks!
MC> --
MC> Martin Cooper
MC> Tumbleweed Communications
MC> ----- Original Message -----
MC> From: "Oleg V Alexeev" <[EMAIL PROTECTED]>
MC> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
MC> Sent: Thursday, January 11, 2001 1:31 PM
MC> Subject: Re[2]: Properties in ActionForms
>> Hello martin,
>>
>> Thursday, January 11, 2001, 10:50:00 PM, you wrote:
>>
>> mctc> Something I am working on at the moment is a very simple utility
MC> that
>> mctc> generates a form bean from an XML definition. The goal is simply to
MC> reduce
>> mctc> typing in generating beans - as Roger mentioned, it is kinda
MC> tedious. I'm
>> mctc> using something like this to specify a bean:
>>
>> mctc> <form-bean name="AddressForm" validate="true">
>> mctc> <property name="street"/>
>> mctc> <property name="city" allowEmpty="false"
>> mctc> errorMessage="error.city.required"/>
>> mctc> <property name="zip" allowEmpty="false"
MC> errorMessage="error.zip.required"/>
>> mctc> </form-bean>
>>
>> mctc> Pretty simplistic stuff, but it meets my needs right now. If this
MC> would be
>> mctc> of interest to people (and if my company allows it), I can make it
>> mctc> available when I'm done.
>>
>> mctc> Also, if people have ideas on what it might do differently, or what
MC> else it
>> mctc> might do, I'd be interested in hearing them. And if anyone has a
MC> copy of
>> mctc> the messages from Mark Wutka mentioned in the Struts 1.1 TODO list,
MC> I'd
>> mctc> appreciate it if they could forward them to me.
>>
>> Good idea. I think global errorMessage for missing properties can be
>> defined. And add type as attribute for property. And add errorMessage
>> for convertion error with property. And add global errorMessage for
>> properties of some type.... 8)
>>
>> --
>> Best regards,
>> Oleg mailto:[EMAIL PROTECTED]
>>
>>
--
Best regards,
Oleg mailto:[EMAIL PROTECTED]