Run:
  Error 1
  Error 2
  No Error
   

View:
basic.tld
BasicTagTLV.java
BasicTagParent.java
BasicTagChild.java
Error 1 jsp
Error 2 jsp
No Error jsp
 
 
 

Tag Validator Examples 

These samples illustrate how to create and use a custom tag validator. The tag validator is new in the JSP 1.2 tag extension. 

Note: Error 1 and Error 2 generate error messages. If you are using Internet Explorer, make sure you have turned off "Show friendly HTTP error messages". This is done via Advanced Internet Options.

There are two tags, <parent> and <child> The child tag must be nested in the parent tag. The parent tag may have a directory attribute or a file attribute, but not both. The child tag's limit attribute must be in range. The BasicTagTLV.java is the Tag Library Validator java class that enforces the above restrictions.

The BasicTagParent and BasicTagChild are skeletal implementations the parent and child tags.

The <taglib> element in the application's web.xml for this tag library is below:

<taglib>
      <taglib-uri>/orabasic</taglib-uri>
      <taglib-location>
          http://xmlns.oracle.com/j2ee/jsp/tld/demos/basic.tld   
       </taglib-location>
   </taglib>

The tld for this library contains the following <uri> element,

<uri>http://xmlns.oracle.com/j2ee/jsp/tld/demos/basic.tld</uri>
which matches the above <taglib-location>. The examples all contain:
<%@ taglib prefix="basic" uri="/orabasic" %>
The <%@ taglib> directive's <uri> value matches the above <taglib-uri>.