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

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.

EX.

within your custom-tag.jsp:
 1
 2<%
 3    String params = StringPool.BLANK;
 4    if (width != null)
 5        "width=\"" + width + "\" ";
 6
 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("/>");
15%>
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?