cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Irv Salisbury <irv.salisb...@gmail.com>
Subject 2nd time through form call
Date Fri, 24 Jun 2005 00:27:17 GMT
We have a flowscript method that shows a form.  After the form is
submitted, we call a sendPage that will essentially show a new
instance of that same form.  With the released rhino version in cocoon
2.1.7, this works fine.  However, for the weblogic workaround of using
the 1.6 released version of rhino we are getting a null pointer
exception.

Here is our method

function addForm( module, screen, tab, originalRequestString ){
  var formDefUrl = "cocoon:/" + getRootUrl() +
"internal/addFormDefinition/" + getTabPath( module, screen, tab );
  cocoon.log.info( "Form def url is: " + formDefUrl );
  var form = new Form( formDefUrl );
  var formBindUrl = "cocoon:/" + getRootUrl() +
"internal/addFormBinding/" + getTabPath( module, screen, tab );
  cocoon.log.info( "Form bind url is: " + formBindUrl );
  form.createBinding( formBindUrl );
	var pipelineUtil = cocoon.createObject( PipelineUtil );
  cocoon.log.info( "About to show add form " );

  //this is needed for grid/repeater stuff
  var screenObject = cocoon.request.getAttribute( "screenObject" );
  /*
  form.restoreHook = 
    function(theForm) { 
      cocoon.log.debug( "Cocoon request is " + cocoon.request );
      cocoon.log.debug( "Screen object is " + screenObject );
      cocoon.request.setAttribute( "screenObject", screenObject ); 
    };
    */
  form.showForm( (getRootUrl() + "style/addForm/" + getTabPath(
module, screen, tab )) );

  // TODO: Need to kill continuations from client side call if tab is changed
  // This is only called if action is performed on the form (submit)
  var dataObject =
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  form.save( dataObject );
  if( cocoon.log.isDebugEnabled() ){
    var stringRep = XMLUtils.serializeNode( dataObject );
    cocoon.log.debug ("Data object from add is " + stringRep );
  }
  cocoon.request.setAttribute( "dataObject", dataObject );
  var dataAddUrl = getRootUrl() + "internal/dataAdd/" + getTabPath(
module, screen, tab );
  var xmlSaxHandler =
XmlBeans.getContextTypeLoader().newXmlSaxHandler(
SessionDataDocument.SessionData.LastOperation.type, null );
  cocoon.log.debug( "Sax handler is" + xmlSaxHandler );
  cocoon.log.debug( "Data add url is " + dataAddUrl );

	pipelineUtil.processToSAX( dataAddUrl + "?" + originalRequestString,
null, xmlSaxHandler.getContentHandler() );
  var addResults = xmlSaxHandler.getObject();
  if( cocoon.log.isDebugEnabled() ){
    cocoon.log.debug ("Add results are " + addResults );
  }

    setLastOperation( addResults );
    var id = "";
    if( (addResults != null) && (addResults.isSetSuccess()) ){
      var valueArray = addResults.getValueArray();
      if( valueArray.length < 1 ){
      }
      else {
        id = valueArray[0].getStringValue();
      }
    }
    else {
      var errorMessage = null;
      if( addResults == null ){
        errorMessage = "No add results";
      }
      else {
        errorMessage = addResults.getFailure().getMessage();
      }
    }
    cocoon.sendPage( getRootUrl() + "screen/" + getTabPath( module,
screen, tab ) + "?" + originalRequestString );
}

The last call to sendPage will essentially bring us back to the same
showForm.  After the second showForm call we get a null pointer
exception trying to access the form object.  So, something is very
different between mozilla 1.6R and the rhino with cocoon 2.1.7

So, is there something I can do differently?  Is there something I
should be doing to cleanup continuations or something?

Irv

Mime
View raw message