hi guys,

I'm binding a java.util.Collection as the source to a component i'm 
creating. What i need to do now is
get certain fields (fName, lName etc) from the element's contained within 
the Collection
and attach it to TextFields which are being dynamically created by a Foreach 
component.

The code in red is supposed to be invalid. So is there a way for me to 
access those fields inside
the collection's elements? ie. col[index].fName?

the component's jwc file:

<component-specification class="com.stchome.pam.tapestry.components.NameSet" 
allow-body="no" allow-informal-parameters="yes">

<parameter 
property-name="source" 
name="source" 
direction="in" 
required="yes" 
type="java.lang.Object">
</parameter>

<component id="elements" type="Foreach">
<inherited-binding name="source" parameter-name="source"/>
</component>

<component id="fName" type="TextField">
<binding name='value' expression="components.elements.fName"></binding>
</component>

<component id="lName" type="TextField">
<binding name='value' expression="components.elements.lName"></binding>
</component>

<component id="iNetHandle" type="TextField">
<binding name='value' expression="components.elements.iNetHandle"></binding>
</component>

</component-specification>

--------------------------------

The component's html file:

<span jwcid="$content$">
<table width="100%">
<span jwcid="elements"> 
<tr>
<td><input type="text" jwcid="fName"/></td>
<td><input type="text" jwcid="lName"/></td>
</tr>
<tr>
<td><input type="text" jwcid="iNetHandle"/></td>
</tr>
</span> 

<tr><td><input jwcid="@Submit" value="Add more names" type="Submit" 
listener="ognl:listeners.anotherNameType"/></td></tr>
</table>
</span>

------------------------------------

The component's class file

import org.apache.tapestry.*;

public class NameSet extends BaseComponent
{
private Object source; 

public Object getSource() {
return source;
}

public void setSource(Object source) {
this.source = source;
}
}

Reply via email to