JSP Tag Libraries

Скачать в pdf «JSP Tag Libraries»


First, let’s look at the tag library descriptor as presented in listing 9.7.


Listing 9.7 Tag library descriptor for the advanced condition tags


<?xml version=»1.0″ encoding=»ISO-8859-1″?>


<!DOCTYPE taglib


PUBLIC «-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN» «
http://java.sun.com/j2ee/dtds/web-j sptaglibrary_1_1.dtd»>


<taglib>


<tlibversion>1.0</tlibversion>


<j spversion>1.1</j spversion>


<shortname>simp</shortname>


<uri>


http://www.manning.com/j sptagsbook/condition-taglib </uri>


<info>


Condition tags library.


</info>


<tag>


<name>with</name>


<tagclass>book.conditions.WithTag</tagclass>


<teiclass>book.conditions.WithTagExtraInfo</teiclass>


<bodycontent>JSP</bodycontent>


<info>


Wrap a JSP fragment with test conditions.


</info>


<attribute>


<name>multichoice</name>


<required>false</required>


<rtexprvalue>false</rtexprvalue>


</attribute>


<attribute>


<name>object</name>


<required>false</required>


<rtexprvalue>true</rtexprvalue>


</attribute>


<attribute>


<name>name</name>


<required>false</required> <rtexprvalue>false</rtexprvalue>


</attribute>


<attribute>


<name>sc ope</name>


<required>false</required> <rtexprvalue>false</rtexprvalue>


</attribute>


<attribute>


<name>index</name>


<required>false</required> <rtexprvalue>true</rtexprvalue>


</attribute>


<attribute>


<name>property</name>


<required>false</required> <rtexprvalue>false</rtexprvalue>


</attribute>


</tag>


<tag>


<name>test</name>


<tagclass>book.conditions.TestTag</tagclass>


<teiclass>book.conditions.TestTagExtraInfo</teiclass>


<bodycontent>JSP</bodycontent>


<info>


Pose a condition on the reference object.


</info>


<attribute>


<name>condition</name>


<required>true</required> <rtexprvalue>false</rtexprvalue>


</attribute>


</tag>


</taglib>


As seen in the TLD, both tags are marked as having JSP contents, which tells the JSP environment to evaluate the body. As for tag attributes, the WithTag entry inherits most of its attributes from ReflectionTag and adds just a single new multichoice attribute, instructing the tag as to the condition evaluation policy that is desired. TestTag, on the other hand, is less complex with only a single tag attribute that specifies the condition string.

Скачать в pdf «JSP Tag Libraries»