• 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:

Data sharing between tags....

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the different ways of sharing data between tags? which is the best and when will each type be appropriate. could anyone please expand on this topic.
Appreciate u'r feedback,
Thanks.
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have used two ways.

One is declare pageContext level variables, if the data is shared for several tags, then you have to use it, but the shortcome is that you have to import the necessary library in the jsp. And you also need a extrainfo class to declare it and destroy it in one of tag or declare the variable in the jsp.
the second one is in nested tags, use: findAncestorWithClass
and get the ancestor and get the data out. You will have to declare the tag in the tld file as can contain jsp in it.
here is the official jsp tag tutorial: http://java.sun.com/products/jsp/tutorial/TagLibrariesTOC.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic