are list and list item, jstl tags? or custom tags you created?
Joined: Dec 08, 2004
Hi, This is a custom tag that I want to create.
Joined: Feb 26, 2005
If your parent is a SimpleTag (SimpleTag interface), then you may have an issue. Please refer to some books on how to get away with it. But if your parent is a Tag (Tag interface), then you can go with this approach below.
You can use the getParent method in the child tag. This method returns a reference to the parent tag instance.
Here's how it can go:
Inside the child class, once you got the reference to the parent instance using getParent(), you can store any data on the parent instance. For example, add an instance variable in the parent tag, like, myName. So in the child tag, you store the name attribute you have, into the parent's myName instance variable. So there you go, the parent now has the name attribute from the child.
Once the child process is done, the control goes back to the parent. At that point, the parent would know the child's name attribute's value, by looking at its instance variable myName.