jwl
jwl

Reputation: 10514

How can you specify allowed values for a tagfile attribute?

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)?

Upvotes: 1

Views: 65

Answers (1)

alfreema
alfreema

Reputation: 1338

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

Upvotes: 1

Related Questions