cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tzi...@s-und-n.de
Subject Re: problem
Date Wed, 28 Mar 2007 11:21:37 GMT
hi there,

make sure you get an instance of the FlowScript Form Class in your 
"do_edit" method. Your Exception Stacktrace indicates that the Form 
variable is unset (undefined) (null).

cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");

This line of FlowScript includes the respective JavaScript file from 
Cocoon Resources.

Freundliche Grüße / With kind regards
Thomas Zirke

S&N AG
Klingenderstr. 5
D 33100 Paderborn

voice           +49 5251/1581-984
fax             +49 5251/1581-71
eMail           tzirke@s-und-n.de
Web             http://www.s-und-n.de

Vorstand
Klaus Beverungen
Josef Tillmann

Vorsitzender des Aufsichtsrates
Heinz-Dieter Wendorff

Handelsregister
Amtsgericht Paderborn HRB 3270




"Rashel Shehata" <rashel.s@gmail.com>
28.03.2007 12:53
Bitte antworten an users
 
        An:     users@cocoon.apache.org
        Kopie: 
        Thema:  problem


Im new to using cocoon and so far so good, but i did run into a few errors 
regarding bean bindings and cforms.

cocoon version #: Cocoon 2.1.10

servlet engine: jetty


the problem: following the bindings sample(samples> blocks>forms> 
form2bean.flow) i created my own framework


in the sitemap: 

         <map:match pattern="do_edit>
       <map:call function="handleForm">
         <map:parameter name="function" value=" do_edit"/>
         <map:parameter name="definitionURI" 
value="forms/form_model.xml"/>
         <map:parameter name="bindingURI" 
value="forms/form_bind_bean.xml"/> 
       </map:call>
     </map:match>

 

the js:

function do_edit(form) {
 
// pass the id of the bean u want to edit in the request parameter
 var id = cocoon.request.getParameter("id"); 


 var q = registry.getBeanWithID(id);
 print("\n the bean we are editing:  "+ q);


    var bean = new Packages.org.apache.cocoon.samples.flow.testBean ();
 bean.setID(q.getID());
 bean.setLabel(q.getLabel());
 bean.setHelp(q.getHelp());
 bean.setHint(q.getHint ());

 print("bean\n:  "+bean);
 

 
    form.load(bean);
form.showForm("viewform-bean-edit.html"); // will be sent to bean-edit.xml

    form.save(bean);
    cocoon.sendPage ("form2bean-success-pipeline", { "form2bean": bean });
}



my testBean class has attributes identical(type and name) to the widgets 
in the form_model.xml, likewise in my form_bind_bean.xml 
i.e. attributes int id, string label, help and hint
thses are all widgets in the bean-edit.xml
 

At runtime i get the following error:

 
org.mozilla.javascript.EcmaError: TypeError: Cannot call method "load" of 
undefined (file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js#203)
TypeError - file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js - 
203:0 
Cocoon stacktrace[hide] 
TypeError: Cannot call method "load" of undefined 
(file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js#203) 
file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js - 203:0
TypeError

Error calling flowscript function do_edit_question 
file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js - 203:0
[EcmaError]
file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js - 203:-1

file:/C:/cocoon/build/webapp/test/forms/test/sitemap.xmap - 32:36
<map:call>
file:/C:/cocoon/build/webapp/test/forms/sitemap.xmap - 308:68
<map:mount>
file:/C:/cocoon/build/webapp/test/sitemap.xmap - 63:65
<map:mount>
file:/C:/cocoon/build/webapp/sitemap.xmap - 1034:92
<map:mount>

 
Java stacktrace[show] 
org.mozilla.javascript.EcmaError
: TypeError: Cannot call method "load" of undefined 
(file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js#203)
                 at 
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
                 at 
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
                 at 
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3235)
                 at 
org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3254)
                 at 
org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3273)
                 at 
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:1969)
                 at 
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2932)
                 at 
script.do_edit_question(file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js:203)
                 at 
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
                 at 
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
                 at 
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
                 at 
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
                 at 
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:159)
                 at 
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:915)
                 at 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:762)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:139)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:118)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:118)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:118)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
                 at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
                 at 
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
                 at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                 at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358)
                 at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
                 at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
                 at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
                 at 
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
                 at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
                 at 
org.mortbay.http.HttpServer.service(HttpServer.java:879)
                 at 
org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
                 at 
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
                 at 
org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
                 at 
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
                 at 
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:300)
                 at 
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:511)

Java full stacktrace[hide] 
org.apache.cocoon.ProcessingException
: Error calling flowscript function do_edit_question
                 at [EcmaError] - 
file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js:203:0
                 at 
file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js:203
                 at <map:call> - 
file:/C:/cocoon/build/webapp/test/forms/test/sitemap.xmap:32:36
                 at <map:mount> - 
file:/C:/cocoon/build/webapp/test/forms/sitemap.xmap:308:68
                 at <map:mount> - 
file:/C:/cocoon/build/webapp/test/sitemap.xmap:63:65
                 at <map:mount> - 
file:/C:/cocoon/build/webapp/sitemap.xmap:1034:92
                 at 
org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.java:145)
                 at 
org.apache.cocoon.components.flow.javascript.LocationTrackingDebugger.getException(LocationTrackingDebugger.java:132)
                 at 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:766)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:139)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:118)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:118)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:118)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
                 at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
                 at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
                 at 
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
                 at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                 at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358)
                 at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
                 at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
                 at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
                 at 
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
                 at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
                 at 
org.mortbay.http.HttpServer.service(HttpServer.java:879)
                 at 
org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
                 at 
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
                 at 
org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
                 at 
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
                 at 
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:300)
                 at 
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:511)
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method 
"load" of undefined 
(file:/C:/cocoon/build/webapp/test/forms/test/flow/flow.js#203)
                 at 
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
                 at 
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
                 at 
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3235)
                 at 
org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3254)
                 at 
org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3273)
                 at 
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:1969)
                 at 
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2932)
                 at 
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
                 at 
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
                 at 
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
                 at 
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
                 at 
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:159)
                 at 
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:915)
                 at 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:762)
                 ... 56 more

Mime
View raw message