Reputation: 183
I am creating some jsp custom tags.Now I have a requirement as follows :
<bb:custom1 id="id1" attr1="<bb:custom2 attr2='attr2val'></bb:custom2>"></bb:custom1>
ie the value for an attribute should be another custom tag which will be resolved by the corresponding tag handler. I could see that this works with all the html tags.But when i tried with my custom tags it does not work.Can some one please tell me how this can be attained.
I am creating custom tags using tag handlers.
Upvotes: 2
Views: 1916
Reputation: 5438
I resolved the problem by using a temporary variable:
<c:set name="val_attr">
<bb:custom2 attr2='attr2val' />
</c:set>
<bb:custom1 id="id1" attr1="${val_attr}"></bb:custom1>
And it will works with any taglibs (e.g. custom2 can be from cc:custom2).
Another advantage is that you does not need to know the function syntax (e.g. if many parameters are needed, which order to put):
<c:set name="val_attr">
<cc:custom2 param2='myparam2' param1='myparam1' />
</c:set>
<bb:custom1 id="id1" attr1="${val_attr}"></bb:custom1>
Upvotes: 1