You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andre Juffer <aj...@sun3.oulu.fi> on 2007/02/25 18:14:38 UTC
Cannot set property: /keywords[1]/keyword - no such property
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?
Thanks,
--
Andre H. Juffer | Email: Andre.Juffer@oulu.fi
The Biocenter and | WWW: www.biochem.oulu.fi/Biocomputing/
the Dep. of Biochemistry | Fax: +358-8-553-1141
University of Oulu, Finland | Phone: +358-8-553 1161
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cannot set property: /keywords[1]/keyword - no such property
Posted by Andre Juffer <aj...@sun3.oulu.fi>.
Grzegorz,
thanks for your reply.
Grzegorz Kossakowski wrote:
> Andre Juffer napisał(a):
>> Hi,
>>
>> 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?
I am sorry. I always meant keyword, never category. (The category is a
typing error.)
> 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.
OK, I see what you mean. The Specification class does include set/get
methods for a number of other properties, including collections, and for
those cases I did use the JavaBeans convention (e.g. an user selects 1
or more categories from a given set of categories). Only for the
keywords I used a repeater and I was under the impression that the
addKeyword(String) method would be the appropriate way to store (add)
keywords into the Specification (I think this was mentioned somewhere on
the web pages of cocoon 2.1.9). I will implement this part with set/get
methods as well. Thanks for pointing this out.
>
> 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.
Point taken. In any case, I did appreciate your help.
--
Andre H. Juffer | Email: Andre.Juffer@oulu.fi
The Biocenter and | WWW: www.biochem.oulu.fi/Biocomputing/
the Dep. of Biochemistry | Fax: +358-8-553-1141
University of Oulu, Finland | Phone: +358-8-553 1161
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cannot set property: /keywords[1]/keyword - no such property
Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cannot set property: /keywords[1]/keyword - no such property
Posted by Andre Juffer <aj...@sun3.oulu.fi>.
Hi All,
1-2 days ago, I've send an email (see below) concerning a problem that I
have with a really simple repeater. I try to add 1 or more keywords to a
Specification class using an "addKeyword(String keyword)" method. Each
keyword is a String. I was hoping that some of you could have a look at
this and explain to me what is wrong. It should be something really
trivial but I don't get it.
Possibly the error ("Cannot set property: /keywords[1]/keyword - no such
property") has to do with <fb:on-bind>? If so, to what is the path
'keyword' then referring? If this is referring to a "setKeyword(String
keyword)" method on the Specification class, that I do not understand
what the purpose of that would be. The idea would be to add all keywords
with the addKeyword method, right? What do I miss?
Thanks,
Andre
Andre Juffer wrote:
> 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?
>
> Thanks,
>
--
Andre H. Juffer | Email: Andre.Juffer@oulu.fi
The Biocenter and | WWW: www.biochem.oulu.fi/Biocomputing/
the Dep. of Biochemistry | Fax: +358-8-553-1141
University of Oulu, Finland | Phone: +358-8-553 1161
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org