Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How can a parent tag access its child tag's attribute in Simple Tag

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know only how parent tag access its child tag's attribute in Classic Tag

Source code from HFSJ

JSP



child tag: MenuItem





In the parent tag: Menu


As far as I understand, the body content is evaluated between doStartTag() and doEndTag().
So, doEndTag() can access its child's attribute.



But, what about Simple Handler Class which has only doTag() method
How can we know the child's attribute is available for the parent. I means in the simple tag, when the body content is evaluated.

All I know is getJspBody().invoke(writer); of Simple Tag can write the body to a writer
 
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Tony.

Modify Menu.java and MenuItem.java as,

Menu.java

and MenuItem.java
 
Tony suankularb
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot , Chinmaya
 
Evacuate the building! Here, take this tiny ad with you:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic