Hello Craig,

Wednesday, November 22, 2000, 10:30:37 PM, you wrote:

CRM> Ned Seagoon wrote:

>>
>> This is a very difficult situation to resolve - and also fits in with the
>> validate returns not specifiying the field that caused the error.
>>

CRM> On this particular topic I need to inject a quick note.

CRM> The Struts 1.0 implementation of reporting errors has been enhanced, and now 
allows you
CRM> to optionally associate particular error mesages with particular input fields if 
you want
CRM> to.  The current <errors> tag does not take advantage of this, but it enables 
smarter
CRM> handling of error message display in the future, or by people who want to do it 
by hand
CRM> right now.

CRM> Craig

I'd glad to suggest my version of errors writing. It use some
additional strings from resource bundles to render error messages and
source field names. It search resource bundle by string, specified as
field name. If nothing found then it uses field-name string, in
another case it uses string from resource bundle as label for
field-name. For each source (field) it renders group of error
messages.
You can without problem specify special delimiters for error rendering
for good look error messages - result of great troubles with our
designer... 8))

Sources in attachments -

ActionErrorsExt -
  extended version of ActionErrors - contains two additional methods:
      getProperties() - returns iterator via set of registered
                        properties
      add( ActionError error ) - register error for default source -
                        ActionErrors.GLOBAL_ERROR

BaseErrorsTag -
  base tag for errors rendering tags

ExtErrorsTag -
  tag to render error

struts.tld -
  description of tag for extended errors rendering
   name - name for bundle with error messages.
   flexible - if not null and nothing found in message bundle by this
        key then message key will be written to page.


Resource bundles can contain strings to support smart rendering of
error messages -

1) header of errors block

org.apache.struts.errors.header=<div align="center"><table border="0"
 cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" width="95%"><tr><td
 width="100%" valign="top" align="left" colspan="2"
 bgcolor="#F3D9B4"><font class="amrtxtbi">Errors
 bgcolor="#F3D9B4">detected!</font></td></tr>

2) footer of errors block

org.apache.struts.errors.footer=</table></div>

3) header of property block

org.apache.struts.errors.prop.header=<tr>

4) footer of property block

org.apache.struts.errors.prop.footer=</tr>

5) header for property name

org.apache.struts.errors.prop.name.header=<td width="20%" valign="top"
 align="left" bgcolor="#FFCC66"><font class="amrtxt">

6) footer for property name
 
org.apache.struts.errors.prop.name.footer=</font></td>

7) header for messages list for single property

org.apache.struts.errors.prop.messages.header=<td width="80%"
 valign="top" align="left" bgcolor="#F3D9B4"><font class="amrtxt">

8) footer for messages list for single property
 
org.apache.struts.errors.prop.messages.footer=</font></td>

9) header for single message

org.apache.struts.errors.prop.message.header=<font class="amrtxt">

10) footer for single message

org.apache.struts.errors.prop.message.footer=</font>


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

ActionErrorsExt.java

BaseErrorsTag.java

ExtErrorsTag.java

struts.tld

Reply via email to