You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sy...@swisscom.com on 2003/03/27 10:39:58 UTC

XMLForm: how to access to a Collection

Hello,

I'm trying to access to a Java Collection from within a XMLForm view.

The Java code is:
----code----
...
Collection col = new HashSet();
...
while (iterator.hasNext()) {
  Group group = (Group) iter.next();
  col.add(group);
}
...
----code----

On my debugger the Collection object "col" looks like:

----debug----
col=java.util.HashSet (id=327)
  ->map=java.util.HashMap (id=329)
      ->table=java.util.HashMap$Entry[11] (id=330)
          ->[2]=java.util.HashMapEntry (id=331)
              ->key=com.swisscom.Group (id=287)
                  ->groupName="test"
                     ->count=3
                     ->hash=0
                     ->offset=0
                     ->value=char[4] (id=212)
                         ->[0]=t
                         ->[1]=e
                         ->[2]=s
                         ->[3]=t
----debug----

I want to display the groupName value.

My view should look like:
<xf:repeat nodeset="?">
  <xf:output ref="?"/>
</xf:repeat>

But I don't know how to access to this Collection (path).
Could you help me?

Thanks
Sylvain

   

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: XMLForm: how to access to a Collection

Posted by ivelin <iv...@apache.org>.
You need to stick the collection in a simple JavaBean container.

public class BeanContainer
{
  Collection get/setMyCollection();
}

then

<xf:repeat nodeset="myCollection">
  <xf:output ref="count"/>
  <xf:output ref="name"/>
   ...
</xf:repeat>




-=Ivelin=-
----- Original Message ----- 
From: <Sy...@swisscom.com>
To: <co...@xml.apache.org>
Sent: Thursday, March 27, 2003 3:39 AM
Subject: XMLForm: how to access to a Collection


Hello,

I'm trying to access to a Java Collection from within a XMLForm view.

The Java code is:
----code----
...
Collection col = new HashSet();
...
while (iterator.hasNext()) {
  Group group = (Group) iter.next();
  col.add(group);
}
...
----code----

On my debugger the Collection object "col" looks like:

----debug----
col=java.util.HashSet (id=327)
  ->map=java.util.HashMap (id=329)
      ->table=java.util.HashMap$Entry[11] (id=330)
          ->[2]=java.util.HashMapEntry (id=331)
              ->key=com.swisscom.Group (id=287)
                  ->groupName="test"
                     ->count=3
                     ->hash=0
                     ->offset=0
                     ->value=char[4] (id=212)
                         ->[0]=t
                         ->[1]=e
                         ->[2]=s
                         ->[3]=t
----debug----

I want to display the groupName value.

My view should look like:
<xf:repeat nodeset="?">
  <xf:output ref="?"/>
</xf:repeat>

But I don't know how to access to this Collection (path).
Could you help me?

Thanks
Sylvain

   

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org