To implement semantic validation for an operation, do the following:
- If the operation does not already implement the OperationXValidate cross-field
validator interface, implement it.
- Write the validate(String, DataField, Context) so that it checks the value
of the field against one or more business rules.
- Make the validate method throw a DSETypeException if the data is not valid
for the field.
To implement semantic validation for a processor, do one of the
following:
- Use the same procedure you use to implement semantic validation for an
operation except that the processor implements the ProcessorXValidate interface.
- Have the processor extend the HtmlProcessorXValidate class, which already
implements the ProcessorXValidate interface. Override the doValidate(String,
DataField, Context) method to perform the semantic validation.
For an example of how semantic data field validation works on
a data field, see the following in the HTML Sample Application:
- validate(String fullyQualifiedName, com.ibm.btt.base.DataField df, com.ibm.btt.base.Context
ctxt) method com.ibm.btt.samples.html.AccountTransferXVal class
- <dse:text dataName="amount" error="yes" size="10" maxLength="10"/> in
transfer.jsp
- <dse:error dataName="amount"/> in transfer.jsp