ExtJS下 Ext.Direct加载和提交过程排错小结

偶泪滴嘎嘎,终于,终于完成了一部分ExtJS。
(基础夯实一点,会有好处的,排错的时候就体现出来了)
下面就Ext.Direct做一些排错笔记:

错误一

复制代码 代码如下:


严重: StandardWrapper.Throwable
java.lang.ArrayIndexOutOfBoundsException: 1
at com.softwarementors.extjs.djn.api.RegisteredStandardMethod.isValidFormHandlingMethod(RegisteredStandardMethod.java:53)
at com.softwarementors.extjs.djn.scanner.Scanner.scanAndRegisterActionClass(Scanner.java:206)
at com.softwarementors.extjs.djn.scanner.Scanner.scanAndRegisterActionClass(Scanner.java:105)
at com.softwarementors.extjs.djn.scanner.Scanner.scanAndRegisterApiConfiguration(Scanner.java:82)
at com.softwarementors.extjs.djn.scanner.Scanner.scanAndRegisterApiConfigurations(Scanner.java:64)
at com.softwarementors.extjs.djn.servlet.DirectJNgineServlet.createDirectJNgineRouter(DirectJNgineServlet.java:182)
at com.softwarementors.extjs.djn.servlet.DirectJNgineServlet.init(DirectJNgineServlet.java:155)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2013-3-28 17:43:52 org.apache.catalina.core.StandardContext loadOnStartup


这是为什么呢?
答案:
@DirectFormPostMethod
这个不对,这个产生了上面的错误,改成: @DirectMethod
同时删掉,由@DirectFormPostMethod生成的输出:

复制代码 代码如下:


import com.softwarementors.extjs.djn.config.annotations.DirectFormPostMethod;


错误二

复制代码 代码如下:


ERROR: com.softwarementors.extjs.djn.router.processor.standard.json.JsonRequestProcessor - "(Controlled) server error: 1 for Method 'FormAction.submitData'" (rid=1000)
java.lang.ArrayIndexOutOfBoundsException: 1
at com.softwarementors.extjs.djn.router.processor.standard.json.JsonRequestProcessor.checkJsonMethodParameterTypes(JsonRequestProcessor.java:352)
at com.softwarementors.extjs.djn.router.processor.standard.json.JsonRequestProcessor.getIndividualRequestParameters(JsonRequestProcessor.java:247)
at com.softwarementors.extjs.djn.router.processor.standard.json.JsonRequestProcessor.processIndividualRequest(JsonRequestProcessor.java:404)
at com.softwarementors.extjs.djn.router.processor.standard.json.JsonRequestProcessor.processIndividualRequestsInThisThread(JsonRequestProcessor.java:143)
at com.softwarementors.extjs.djn.router.processor.standard.json.JsonRequestProcessor.process(JsonRequestProcessor.java:126)
at com.softwarementors.extjs.djn.router.RequestRouter.processJsonRequest(RequestRouter.java:83)
at com.softwarementors.extjs.djn.servlet.DirectJNgineServlet.processRequest(DirectJNgineServlet.java:617)
at com.softwarementors.extjs.djn.servlet.DirectJNgineServlet.doPost(DirectJNgineServlet.java:580)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


控制层出错,也就是逻辑上不对,我的函数里面要求传入的参数,和提交的参数不对,
放心,不是xml配置问题,是传入的参数问题。所以重点在参数上,也就是语法。

我的错误原因
Java要求传入的参数为两个:

复制代码 代码如下:


public Info submitData(String name,String password)


而我在ExtJS 中实际传入的参数是一个:

复制代码 代码如下:


var params= username.getValue()+Password.getValue();
FormAction.submitData(params,function(result,e){}


改写一下就行了:

复制代码 代码如下:


FormAction.submitData(username.getValue(),Password.getValue(),function(result,e){}


错误三

复制代码 代码如下:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdgpwf.html