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 TLDThe 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 ClassAdditional 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 TimeIn 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. |