Seems like there is a mechanism to support key - value pairs (something like a Map) in the TagSupport class. I assume its like xxxAttribute() kinda framework. Anyone know what/where these are used for? I mean in practice/production? - satya...........trying to put learning into real world apps!
satya - Well, I'm one of those people who like to read code. In TC 4.01 it's a HashTable, declared private, in TagSupport. The getValue, getValues, removeValue, setValue public methods are not used by local code. BodyTagSupport does not call any of these methods either. So .... it seems like a built-in lookup mechanism for any user tag handler code to use. I sure don't see any doc's on this anywhere 'tho. Also, why no mechanism to 'getKeys'? Later, Guy
Hi, The TagSupport setValue(), getValue(), etc. methods are intended to be used for nested cooperating tags, to share some dynamically created objects. The enclosing tag creates an objects an puts it using setValue(). The object is available to all inner tag handlers through the use of ((TagSupport)getParent()).getValue(name). It is the same as using pageContext.getAttribute() or pageContext.setAttribute(), however, in this case it uses a private namespace for the nested tags handlers, instead of a common general one.
hi, it is really good question. we can use map interface in situations like where in we have to store indices too. for example a[]={2,3,4,5,5}; we can use some variable 'i' as an index to retrieve value from the data structure ...here we are not storing indices.. but what if we want set our own index and different index some thing more understandle to retrieve data from the data struture. for example a[father]= 50; a[mother]= 45; a[son]= 35; a[dog]= 30; in the above data struture,,,we have control over index. actually the above specified example is not correct in any language but for the purpose of understanding how map actually works,i gave that example. one example..like dictionary a[obsolete]= old; we can use in such sort of situations. hope i have given convincing answer to your question. good luck guys.
In one of the earlier responses, the following statement was made:
In TC 4.01 it's a HashTable, declared private, in TagSupport. The getValue, getValues, removeValue, setValue public methods are not used by local code. BodyTagSupport does not call any of these methods either.
I thought that BodyTagSupport would be able to call these methods because it is extended from TagSupport. Also, the JavaDocs for BodyTagSupport show these methods as available to BodyTagSupport throught inheritance. Can anyone clarify this point?
Post by:autobot
I was her plaything! And so was this tiny ad:
a bit of art, as a gift, the permaculture playing cards