Return-Path: X-Original-To: apmail-cocoon-users-archive@www.apache.org Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F3626727C for ; Tue, 20 Sep 2011 08:23:21 +0000 (UTC) Received: (qmail 50938 invoked by uid 500); 20 Sep 2011 08:23:21 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 50893 invoked by uid 500); 20 Sep 2011 08:23:21 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 50886 invoked by uid 99); 20 Sep 2011 08:23:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2011 08:23:21 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [57.67.164.69] (HELO be1ssnxpe1.nxp.com) (57.67.164.69) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2011 08:23:15 +0000 Received: from eu1rdcrdc1vw040.exi.nxp.com ([134.27.176.148]) by be1ssnxpe1.nxp.com (8.14.4/8.14.4) with ESMTP id p8K8Mqvu032389 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Tue, 20 Sep 2011 10:22:52 +0200 Received: from eu1rdcrdc1wx032.exi.nxp.com ([134.27.179.186]) by eu1rdcrdc1vw040.exi.nxp.com ([134.27.176.148]) with mapi; Tue, 20 Sep 2011 10:22:52 +0200 From: Robby Pelssers To: "users@cocoon.apache.org" , "Andre.Juffer@oulu.fi" Date: Tue, 20 Sep 2011 10:22:52 +0200 Subject: RE: Cocoon3: string-template; collections Thread-Topic: Cocoon3: string-template; collections Thread-Index: Acx3bXms92/Za0hxRGuuucF/i6oc2AAAKqhQ Message-ID: <78B923726E7D59429936580CF127E943A17ED7FC8A@eu1rdcrdc1wx032.exi.nxp.com> References: <4E784B6F.2060300@cc.oulu.fi> In-Reply-To: <4E784B6F.2060300@cc.oulu.fi> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.4.6813,1.0.211,0.0.0000 definitions=2011-09-20_02:2011-09-20,2011-09-20,1970-01-01 signatures=0 Hi Andre, I found some example online but I haven't tested it personally. The example= the syntax how to iterate
    $orders: {order|
  • Order $order.OrderId$
  • }$
Let me know if that works out for you. Robby -----Original Message----- From: Andre Juffer [mailto:ajuffer@cc.oulu.fi]=20 Sent: Tuesday, September 20, 2011 10:15 AM To: Cocoon Users Subject: Cocoon3: string-template; collections Hi, I am dealing with the following. I created a simple REST resource, like=20 (without setters): @Path("/test") public class TestResource { @GET @Path("/{id}") public Response getTest(@PathParam("id") String id) { TestDTO testDTO =3D this.testFacade.find(id); Map map =3D new HashMap(); map.put("test", testDTO); return=20 URLResponseBuilder.newInstance("servlet:tribc-tct:/test.json", map).build()= ; } } The TestFacade returns a DTO (data transfer object) and this DTO exposes=20 a number of getters. The application must be able to return both XML and=20 JSON. So, I place the DTO in a map and 'call' the sitemap for generated=20 the response (here as JSON): The test.xml looks like: $test.testId$ $test.name$