cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: xform repeat and java beans: null pointer exception
Date Mon, 24 Mar 2003 13:23:01 GMT
Hi Dan,
I don't know if you can use array with <repeat> tag.
I'm using a HashMap instead of an Array (see the wizard example).
It works fine for me.
Don't forget to initialize the object.
Before that I tried to do the same thing with a Collection but it didn't work for me.
Sylvain (T)

-----Message d'origine-----
De: Barber, Dan []
Date: vendredi, 21. mars 2003 18:01
Objet: xform repeat and java beans: null pointer exception


There might be a simple solution to this problem, but I have not been able to find it.  Here
is the problem: 

I have a Java Bean that returns an array of objects.  I try to display the list using the
xf:repeat in an xml file.  Here's the bean, xml and sitemap entries:

Cocoon version 2.1 latest CVS files 
Notes: I have all log levels set to DEBUG.  I haven't found any useful info listed in the
log file. 


<?xml version="1.0" ?> 
<document xmlns:xf=""> 

<xf:form id="form-feedback" view="start" action="ruleset"> 
 <xf:output ref="/dummys[2]"/>   <!-- this works fine --> 

 <xf:repeat nodeset="/dummys">  <!-- this generates an exception.  Please see exception
below --> 
    <xf:output ref="."/> 


public class RuleSetHelperBean 
        public RuleSetHelperBean() 
                dummys[0] = new String("blah1"); 
                dummys[1] = new String("blah2"); 

        public String[] getDummys() 
                return dummys; 

        public String getDummys(int idx) 
                return dummys[idx]; 

        protected String dummys[] = new String[2]; 

Sitemap entries (relevant to this problem) 
      <map:action name="RuleSetAction" src="com.test.RuleSetAction"  logger="xmlform.sitemap.action.ruleset"/>

      <map:match pattern="ruleset*"> 
        <map:act type="RuleSetAction"> 

          <!-- XMLForm parameters for the AbstractXMLFormAction --> 
          <map:parameter name="xmlform-validator-schema-ns" value=""/>

          <map:parameter name="xmlform-validator-schema" value="schematron/ruleset-xmlform-sch-report.xml"/>

          <map:parameter name="xmlform-id" value="form-feedback"/> 
          <map:parameter name="xmlform-scope" value="session"/> 
          <map:parameter name="xmlform-model" value="com.test.RuleSetHelperBean"/> 

Browser exception 
An error occurredorg.apache.cocoon.ProcessingExceptionFailed to execute
Failed to execute pipeline.: java.lang.NullPointerExceptionOriginal exception : java.lang.NullPointerException
at org.apache.xalan.transformer.TransformerIdentityImpl.flushStartDoc(
at org.apache.xalan.transformer.TransformerIdentityImpl.startPrefixMapping(
at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.startNode(
at org.apache.cocoon.xml.dom.DOMStreamer$
at at org.apache.cocoon.xml.XMLUtils.serializeNode(
at org.apache.cocoon.xml.XMLUtils.serializeNodeToXML( at org.apache.cocoon.transformation.AbstractSAXTransformer.endRecording(
at org.apache.cocoon.transformation.XMLFormTransformer.endTransformingElement(
at org.apache.cocoon.transformation.AbstractSAXTransformer.endElement(
at org.apache.cocoon.components.sax.XMLTeePipe.endElement( at org.apache.xerces.parsers.AbstractSAXParser.endElement(
at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(

Dan Barber 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message