• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

how comws varaible in the tag

 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a doubt regarding ho many possible child elements are there for the <tag> element in the .tld file.

For EXAMPLE:

In HFSJ book, there are not mention anything about <variable> element and its child element?

What is the menaing of <variable> and how to use it in the jsp page? Please give a sample coding of how to use it in the JSP?

What are the other possible child elements for <variable> element? What are the other possible values for the <scope>?Where can i get more infomation regarding it?

What is the meaning of AT_BEGIN.. in the <scope>?
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic