wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes How can a parent tag access its child tag's attribute in Simple Tag 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 "How can a parent tag access its child tag Watch "How can a parent tag access its child tag New topic
Author

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

Tony suankularb
Greenhorn

Joined: Aug 10, 2009
Posts: 19
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
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi, Tony.

Modify Menu.java and MenuItem.java as,

Menu.java

and MenuItem.java
Tony suankularb
Greenhorn

Joined: Aug 10, 2009
Posts: 19
Thanks a lot , Chinmaya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can a parent tag access its child tag's attribute in Simple Tag