Hi,
I am running short on time, but here is a very short hint on how to get you
going. Perhaps it is not the most beautiful solution but it should work.
Let's assume that you have a list of Shops and each shop has a list of
Items.
In your jsp, use displayTag to display the list of Shops.
Then, in the column where the list of items is put
<display:column property="items"
title="shopitems"
decorator="com.MyShopItemsDecorator">
Your decorator should look something like this:
/* (non-Javadoc)
* @see org.displaytag.decorator.DisplaytagColumnDecorator#decorate(
java.lang.Object, javax.servlet.jsp.PageContext,
org.displaytag.properties.MediaTypeEnum)
*/
public Object decorate(Object value, PageContext pageContext,
MediaTypeEnum mediaTypeEnum)
throws DecoratorException {
if (value == null) {
return "";
}
if (! (value instanceof List)) {
return "Wrong parameter type";
}
List items = (List) value;
if (items.size() == 0) {
return "";
}
// add your code to process the list ...
Iterator iterator = items.iterator();
StringBuffer result = new StringBuffer("");
Item item;
while (iterator.hasNext()) {
item = (Item) iterator.next();
result.append(item.getName()).append(" < b r / >");
}
return result.toString();
}
On 9/18/07, Aswin Thoudam <[EMAIL PROTECTED]> wrote:
>
> Hi all
>
> I am new to display tags. And i want to use TableDecorator on my List of
> beans
> The problem is my bean has a list of another bean B and the property i
> want to display is a property of the bean inside the nested collection. Both
> the outer as well the inner collection is being shown in the same table, not
> in a nested table;
> I can display the unformatted values. Now I want to format the data that
> is being displayed based on some conditions defined in the decorator.
>
> Thx in adv
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> displaytag-user mailing list
> displaytag-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user