Forums Register Login

TagSupport class defines xxxValues ?

+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
I am not sure either....haven't seen much discussion on this.
- satya
+Pie Number of slices to send: Send
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.

See “Cooperating Tags” in the J2ee tutorial http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPAdvanced8.html

Dani
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thanks for the link Dani. That small page was chockfull of information!!
+Pie Number of slices to send: Send
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?
I was her plaything! And so was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1781 times.
Similar Threads
Need version when Class TagSupport is added to jsp.api
JSP Custom Tag - Invalid content was found with element taglib.
Unable to compile class for JSP (Using custom tag)
Classic tag error
TagSupport
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:38:39.