I modified the bean binding example and the bean is updating fine. I also have a working Java method that uses a stored procedure to update my postgresql db. The problem that I am experiencing is that I'm not sure where/how to call the update method once the values in the form have been bound to the bean. I'm sure that there must be an extremely simple resolution.
Any direction would be appreciated.
That's one possible way to handle it that I have chosen too. The NPE must be in your Java code as a NPE in Javascript would look different (something about "undefined has no property"). The stacktrace should also give you hints where the NPE occurs.
Joerg
Here is my flowscript:
// bean variant of the binding sample function registration2bean(form) { var bean = new Packages.net.mycompany.cocoon.forms.Registration2Bean();
// fill bean with some data to avoid users having to type to much bean.setEmailAddress("[EMAIL PROTECTED]"); bean.setFirstName("Joe"); bean.setLastName("Smith"); bean.setGender("M"); bean.setStreetAddress("120 Winding Trail Lane"); bean.setCity("Pittsburgh"); bean.setState("PA"); bean.setZip("15215"); bean.setHomeAreaCode("412"); bean.setHomePrefix("963"); bean.setHomeSuffix("7777"); bean.setHomeExtension(""); bean.setAlternateAreaCode("904"); bean.setAlternatePrefix("963"); bean.setAlternateSuffix("7777"); bean.setAlternateExtension("4444"); bean.setLoginName("jsmith"); bean.setPassword("password"); bean.setDate(new java.util.Date()); bean.setOptIn(true); form.load(bean); form.showForm("registration-display-pipeline"); form.save(bean);
bean.getStatus(); //FAILS HERE with Null pointer exception while trying to call metheod that commits data to db.
//Method should update db and return a "1" if db is successfully updated.
//Specific Error follows:
//uncaught JavaScript exception: at registration2bean
//(file:/opt/tomcat/webapps/cocoon-dev/medportal/qkb/flow/registration.js, Line 71):
// java.lang.NullPointerException
cocoon.sendPage("registration2bean-success-pipeline", { "registration2bean": bean });
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
