How can you specify allowed values for a tagfile attribute?

80 views Asked by At

In a JSP tag file you get to specify what attributes the tag supports. For a particular attribute, can you specify what are the legal options for that attribute (and have the page throw an error if you specify something other than a legal option for that attribute)?

1

There are 1 answers

1
alfreema On

Not in the taglib's TLD file. You add getters and setters for each of the attributes to the custom tag class that you have written and you check the values for the attributes (and reject them if necessary) in the setter method.

Here is a nice overview: http://www.tutorialspoint.com/jsp/jsp_custom_tags.htm