Liferay is a Gartner Magic Quadrant Leader for the Sixth Year! Find out why

Combination View Flat View Tree View
Threads [ Previous | Next ]
Glenn Powell
IncludeTag doesn't support IterationTag features
February 13, 2008 7:33 AM

Glenn Powell

Rank: Junior Member

Posts: 44

Join Date: January 8, 2008

Recent Posts

I've been working on creating my own taglib, and I've found that using the Liferay IncludeTag (taglib.util) doesn't iteratively evaluate the generated content of a tag. Thus you cannot have your tag's JSP file dynamically output another custom taglib tag.


within your custom-tag.jsp:
 3    String params = StringPool.BLANK;
 4    if (width != null)
 5        "width=\"" + width + "\" ";
 7    StringBuffer tag = new StringBuffer();
 8    tag.append("<liferay-ui-ext:another-custom-tag userId=\"");
 9    tag.append("\" ");
10    tag.append(user.getUserId());
11    if (!Validator.isNull(url))
12        tag.append("url=\"" + url + "\" ");
13    tag.append(params);
14    tag.append("/>");
16    <%= tag.toString() %>

You see that I've inserted a dynamic attribute, which is why I need this iterative evaluation in the first place.

IterationTag (which IncludeTag ultimate implements) is suppposed to support this sort of functionality via the doAfterBody method, but because IncludeTag doesn't use the BodyContent (and instead simply writes the page.jsp directly to PageContext), this functionality isn't accessible.

Can this be fixed in a new version? Or is there some other workaround?