Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with the Dynamic Attribute API.  RSS feed

Abhijit Ghatnekar
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I want to set up dynamic attributes (and also the optionlist) for some of the <select> dropdowns on one of my site's search page.
Here are the steps that I followed:

1) My Tag Handler class implements the DynamicAttributes.
2) I then overrode the setDynamicAttributes(String uri, String name, Object value) which stores the attribute names and values in a locally declared Hashmap
3) In doTag() method, I retrieved the set of attributes from the Hashmap and generated the dropdowns.
4) I, then configured the 'required' attributes in the TLD and these have setter methods in my tag handler class and I also set the <dynamic-attributes> element to true.

I have 3 questions.

1) I have a total of 6 dropdowns on the page and I want onchange attribute (and a few more) to be added to those. How and where should I call the setDynamicAttributes() attributes method?
2) The optionlist for each of those dropdowns comes up from the DB can you propose any generic code/idea that (it has to be reusable) I can use to fill up the optionlist attribute for the 6 dropdowns? And this code goes in the setter method for optionlist, correct?
3) setDynamicAttributes(String uri, String name, Object value) - I did not understand the purpose of the URI parameter here. Does it denote an XML/XSI namespace or something of that sort?

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!