This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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?