JSP.5.7 Validation


Frequently there are constraints on how actions are to be used, and when these constraints are not kept an error should be reported to the user . There are several mechanisms in the JSP 1.1 specification to describe syntactic and semantic constraints among actions; future specifications may add additional mechanisms.

JSP.5.7.1 Syntactic Information on the TLD

The tag library descriptor contains some basic syntactic information. In particular, the attributes are described including their name , whether they are optional or mandatory, and whether they accept request-time expressions. Additionally the bodycontent attribute can be used to indicate that an action must be empty.

All constraints described in the TLD must be enforced. A tag library author can assume that the tag handler instance corresponds to an action that satisfies all constraints indicated in the TLD.

JSP.5.7.2 Syntactic Information in a TagExtraInfo Class

Additional translation-time validation can be done using the isValid method in the TagExtraInfo class. The isValid method is invoked at translation time and is passed a TagData instance as its argument.

JSP.5.7.3 Raising an Error at Action Time

In some cases, additional request-time validation will be done dynamically within the methods in the tag handler. If an error is discovered , an instance of JspError can be thrown. If uncaught, this object will invoke the error page mechanism of the JSP specification.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net