This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes TagSupport class defines xxxValues ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "TagSupport class defines xxxValues ?" Watch "TagSupport class defines xxxValues ?" New topic
Author

TagSupport class defines xxxValues ?

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
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!


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
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
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
I am not sure either....haven't seen much discussion on this.
- satya
Dani Mazzuca
Ranch Hand

Joined: May 21, 2003
Posts: 70
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
Ramana Kumar Atmakuru
Greenhorn

Joined: Jul 13, 2003
Posts: 6
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.
Ken Januski
Ranch Hand

Joined: Aug 08, 2002
Posts: 130
Thanks for the link Dani. That small page was chockfull of information!!
Louise Haydu
Ranch Hand

Joined: Aug 17, 2000
Posts: 51
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?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: TagSupport class defines xxxValues ?