Andre Juffer napisaƂ(a):
Hi,

I have a problem with a very simple repeater in cocoon-2.1.9/tomcat-5.5.16/java-1.6.

This is the binding that I use:

<fb:repeater id="keywords" parent-path="." row-path="keywords">
<fb:on-bind>
<fb:value id="keyword" path="keyword" />
</fb:on-bind>
<fb:on-delete-row>
<fb:delete-node />
</fb:on-delete-row>
<fb:on-insert-row>
<fb:insert-bean classname="java.lang.String"
addmethod="addKeyword" />
</fb:on-insert-row>
</fb:repeater>

The class for which the binding is, contains, among other,

public class Specification {
...
public void addCategory(String category)
{
this.categories.add(category);
}
}

There is no setCategory(String category) method.

Below is the relevant portion of the definition:

<fd:repeater id="keywords" initial-size = "1">
<fd:widgets>
<fd:field id="keyword" required="true">
<fd:label>Keyword</fd:label>
<fd:datatype base="string" />
</fd:field>
...
</fd:widgets>
</fd:repeater>

The flow contains, among other,

var spec = new Specification();
...
form.save(spec);
..

The error message that I get when form.save(spec) is executed is:

org.apache.commons.jxpath.JXPathException: Cannot set property: /keywords[1]/keyword - no such property

What exactly is the meaning of the error? Should there be a setCategory() method on the Specification class? That would not make sense to me. What is missing/wrong?

1. your errors is about keyword property and one sentence later you talk about category property. Where this inconsistency comes from? 2. fb:insert-bean will work only with JavaBeans, and String is not JavaBean. Also, this is much too complicated way of binding. You should have just:
Collection getKeywords();
setKeywords(Collection keywords);
methods. Following JavaBeans convention is really good idea here because it's only way to work with binding lightly.

If you want further help, ask providing more details (especially on why you don't follow JavaBean convention) and ask just once. It's enough and attract the same amount of attention.

--
Grzegorz Kossakowski

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to