dbforms
Tag xmlErrors
Custom tag that renders error messages if an
appropriate request attributehas been created. Used
in conjuction with xml error manager
Example:
In order to manage error messages more
efficiently, we introduced the new XmlError tag.
Instead of hard coding your error messages
within your interceptors, you can now define
them in an xml file which is loaded at
application start-up (in the exact same manner
as the dbForms-config.xml file!) Furthermore,
messages may be stored (and retrieved) for any
given language. Here is how it works
Create an xml error file called
dbForms-errors.xml with the following structure:
<dbforms-errors>
<error id="001"
type="WARN">
<message
language="Fracais">% - Champ
est obligatoire%
</message>
<message language="English">% -
is mandatory %"</message>
</error>
</dbforms-errors>
Replace the errors tag by the xmlErrors tag (in
your jsp's).
In your interceptor, throw a ValidationException
with the following message construct:
Language-MessageID:parameter,parameter,parameter
Where:
Language = used to locate which message to
return, ends with a dash (-)
Message ID = error ID used for lookup, ends
with a colon (:)
Parameter(s) = separated by commas, read in
sequence, replaces placeholders (%) in
message
Example:
String messageConstruct =
"English-001:param1,param2";
throw new
ValidationException(messageConstruct);
Note that you may also use this mechanism to
intercept error messages which are generated by
the database. Ie: Oracle throws the following
message: ORA-0001: blah blah blah
<dbforms-errors>
<error id="0001"
type="WARN">
<message
language="ORA">Oracle message:
% </message>
</error>
</dbforms-errors>
Tag Information |
Tag Class | org.dbforms.taglib.DbXmlErrorsTag |
TagExtraInfo Class | None |
Body Content | empty |
Display Name | None |
Attributes |
Name | Required | Request-time | Type | Description |
caption | false | true | java.lang.String |
caption of the error-list
default = "Error:"
|
name | false | true | java.lang.String |
the name that should be used for retrieving
the error-data from the session
default = "errors"
|
Variables |
No Variables Defined. |
Output Generated by
Tag Library Documentation Generator.
Java, JSP, and JavaServer Pages are trademarks or
registered trademarks of Sun Microsystems, Inc. in the US and other
countries. Copyright 2002-4 Sun Microsystems, Inc.
4150 Network Circle
Santa Clara, CA 95054, U.S.A.
All Rights Reserved.