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.
 
Regards
Sylvain (T)

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



Hi, 

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. 

------------- 
start.xml 
-------------- 

<?xml version="1.0" ?> 
<document xmlns:xf=" http://xml.apache.org/cocoon/xmlform/2002";> 

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

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

</xf:form> 
</document> 

---------- 
Bean 
---------- 
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=" 
http://www.ascc.net/xml/schematron"/> 
          <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 
pipeline.org.apache.cocoon.ProcessingException: Failed to execute pipeline.: 
java.lang.NullPointerExceptionOriginal exception : java.lang.NullPointerException at 
org.apache.xalan.transformer.TransformerIdentityImpl.flushStartDoc(TransformerIdentityImpl.java:888)
 at 
org.apache.xalan.transformer.TransformerIdentityImpl.startPrefixMapping(TransformerIdentityImpl.java:931)
 at 
org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.startNode(DOMStreamer.java:442)
 at 
org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.stream(DOMStreamer.java:259)
 at org.apache.cocoon.xml.dom.DOMStreamer.stream(DOMStreamer.java:173) at 
org.apache.cocoon.xml.XMLUtils.serializeNode(XMLUtils.java:230) at 
org.apache.cocoon.xml.XMLUtils.serializeNodeToXML(XMLUtils.java:181) at 
org.apache.cocoon.transformation.AbstractSAXTransformer.endRecording(AbstractSAXTransformer.java:496)
 at 
org.apache.cocoon.transformation.XMLFormTransformer.endTransformingElement(XMLFormTransformer.java:965)
 at 
org.apache.cocoon.transformation.AbstractSAXTransformer.endElement(AbstractSAXTransformer.java:355)
 at org.apache.cocoon.components.sax.XMLTeePipe.endElement(XMLTeePipe.java:124) at 
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:579) at 
org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:897)
 at 

Thanks! 
Dan Barber 



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

Reply via email to