Access variables between nested JSP tags

Posted by user308053 on Stack Overflow See other posts from Stack Overflow or by user308053
Published on 2010-04-03T00:18:29Z Indexed on 2010/04/03 0:23 UTC
Read the original article Hit count: 865

Filed under:
|

I would like to exchange information between two nested JSP tagx artifacts. To give an example:

list.jspx

<myNs:table data="${myTableData}">
    <myNs:column property="firstName" label="First Name"/>
    <myNs:column property="lastName" label="Last Name"/>
</myNs:table>

Now, the table.tagx is supposed to display the data columns as defined in the nested column tags. The question is how do I get access to the values of the property and label attributes of the nested column tags from the table tag. I tried jsp:directive.variable but that seems only to work to exchange information between a jsp and a tag, but not between nested tags.

Note, I would like to avoid using java backing objects for both the table and the column tags at all.

I would also like to know how I can access an attribute defined by a parent tag (in this example I would like to access the contents of the data attribute in table.tagx from column.tagx).

So it boils down to how can I access variables between nested JSP tags which are purely implemented through the tag definitions themselves (no Java TagHandler implementation desired)?

© Stack Overflow or respective owner

Related posts about java

Related posts about jsp-tags