I use Charles Lyons as my secondary resource. I am using it to help me answer your questions.
I have a doubt regarding how many possible child elements are there for the <tag> element in the .tld file:
description, display-name, icon, name, tag-class, tei-class, body-content, variable, attribute, dynamic-attribute, example, and tag-extension. In HFSJ book, there are not mention anything about <variable> element and its child element?
What is the meaing of <variable> and how to use it in the jsp page? Please give a sample coding of how to use it in the JSP?
The variable element is used to specify the scripting variables exposed by the tag. Using this element in the TLD is the easiest way to do that. jsp:useBean is an action that exposes a scripting variable for the JSP to use after its invocation.
If I am correct, assuming that useBean stores the bean in a scoped attribute it then supplying a variable element allows you to have access to a scripting element in your JSP (translated servlet) that is synchronized with the scoped attribute. The scope element then defines how the synchronization works. It defines where the scripting variable will be declared in the translated servlet.
AT_BEGIN variables are created in servlet code(translated JSP -> servlet) before the tag is invoked allowing the variable to exist throughout the tags life and after it has finished being invoked. The scripting variable is synchronized after every iterarion of the body and again after the tag has been completed (after doEndTag() in a classic tag)
NESTED variables are created before the handler is invoked and does not exist after it has completed. It is only synchronized each time the body has been processed. Once the tag has completed the scripting variable no longer exists in the JSP.
AT_END variables are created when the tag has completed and are created once the doEndTag has returned. Example of a translated servlet using scope AT_BEGIN:
What are the other possible child elements for <variable> element?
description, variable-class, declare, scope (name-given|name-from-attribute)
What are the other possible values for the <scope>?
[I]See above Where can i get more infomation regarding it?
Charles Lyons - Sun Certified Web Component Developer Study Companion What is the meaning of AT_BEGIN.. in the <scope>?
I hope I answered that above Kevin
[ February 11, 2007: Message edited by: Kevin DesLauriers ]