Search code examples
javajsptag-library-descriptor

How can be a JSP ".tag" file documented?


There is a JSP Tag file like this:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ attribute name="attr" required="true" type="java.lang.String" rtexprvalue="true" description="FOOO" %>

<%@ attribute name="var" required="true" type="java.lang.String" rtexprvalue="false" description="BAAR" %>
<%@ variable name-from-attribute="var" variable-class="java.lang.String" alias="attrValue" scope="AT_BEGIN" %>

<c:set var="attrValue" value="${requestScope[attr]}" />

It seems to be possible to document the attributes. How to add documentation to the tag itself?


Solution

  • The proper place to describe a tag and its properties (including attributes) is the Tag Library Descriptor. The description attribute of the attribute directive is IMHO a left-over "from the dark past" and does not have any real use nowadays.