commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jyotsna" <jyotsna.bharad...@spearheadit.com>
Subject Exception while setting values for Collection /ArrayList using JXpath
Date Tue, 20 Feb 2007 09:51:22 GMT
Hi 
 
I have a java bean with the following attributes and their getters and
setters.
 
************************************************************
 
public class OrganisationType implements Serializable {
 
    Long id;
    String code;
    String  description;
    int version;
    Collection arr =new ArrayList();
    HashMap hsh =new HashMap();
   
Getter and setters follow.......................
 
************************************************************
 
I am using the following code to populate the array list 
 
   OrganisationType orgna = new OrganisationType();
   orgna.setCode("12121");
   JXPathContext contexts = JXPathContext.newContext(orgna);
   contexts.setValue("arr[1]","12");
 
 
****************And the Exception I get is ***************************
org.apache.commons.jxpath.JXPathException: Exception trying to set value
with xpath arr[1]; Index: 0, Size: 0
      at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValue(JXPathC
ontextReferenceImpl.java:421)
      at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValue(JXPathC
ontextReferenceImpl.java:412)
      at TestJxPath.main(TestJxPath.java:36)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message