11.3. Checking Syntax with TagLibraryValidator

Your tag handlers (i.e., classes that implement the Tag interface, usually by extending TagSupport or BodyTagSupport) can handle some simple usage errors at request time. For instance, if your tag has an attribute that expects an integer, the associated set Xxx method should convert the incoming String to an int by putting the call to Integer.parseInt within a try/catch block to handle situations where a malformed value is supplied. In addition to these request time checks, the system will automatically do simple syntax checking at page translation time based on information supplied in the TLD file. For example, if you misspell an attribute or omit one that is listed as required, the system will ...

Get More Servlets and JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.