tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Petrelli <antonio.petre...@gmail.com>
Subject Re: Usage of Tiles 2 Velocity tags for attribute lists
Date Sun, 13 Dec 2009 09:28:19 GMT
2009/12/13 Xabier Burgos Gimeno <xabier.burgos@yahoo.es>:
> <meta name="keywords" content="#foreach($keyword in $metaKeywords)$tiles.getAsString({"name":"$keyword"}),#end"/>

The $tiles.getAsString call, as all the methods in Tiles2Tool, has the
same meaning as the <tiles:getAsString> tag in JSP: it writes an
attribute as a string. It does not return a string.
In your case you have only one named attribute, "metaKeywords", that
is a list attribute. You have two options:

1) Using Tiles2Tool in a tag-style, using $tiles.importAttribute to
get the list attribute and then iterate this attribute and use:
$tiles.getAsString({"value": $myIteratedAttribute}

2) Using VelocityStyleTilesTool:
this way:

#foreach($attribute in $tiles.getAttribute("metaKeywords").value)
$attribute.value ,

(I am not completely sure about the syntax :-S )


View raw message