ajax提交数据找不到action问题

闫邴轲 发布于 2015/10/13 20:57
阅读 992
收藏 0
登录完成
2015-10-13 20:41:34  Exception occurred during processing request: Unable to instantiate Action, ledgerAction,  defined for 'save_ledger' in namespace '/oa'ledgerAction
Unable to instantiate Action, ledgerAction,  defined for 'save_ledger' in namespace '/oa'ledgerAction
at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:316)
at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397)
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:552)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
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:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: ledgerAction
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
at com.opensymphony.xwork2.ObjectFactory.getClassInstance(ObjectFactory.java:128)
at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:233)
at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:153)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:171)
at com.opensymphony.xwork2.factory.DefaultActionFactory.buildAction(DefaultActionFactory.java:22)
at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:141)
at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:297)
... 24 more

上面是错误

我是用的ajax提交数据来进行保存操作。他提示找不到action

下面是js方法

<script>
//保存
function save(){
alert("11")
var param = tools.formParams("param");
alert("22")


$.ajax({
url : "/oa/save_ledger",
data : param,
type : "post",
dataType : "json",
async : false,
success : function(data) {


if (data.success) {





location.reload(); 


isAllowed = true;
} else {


var _case = {
1 : "数据异常请联系管理员"
};
tools.adminErrorTip(_case, data.code);
isAllowed = false;
}
}
});
}
</script>
  跪求大神!!!1

加载中
0
北风刮的不认真了
北风刮的不认真了
看你配置的struts.xml。错误应该能在那里找到就,就是配置路径的地方。
0
kaole
kaole

ClassNotFoundException: ledgerAction

检查配置文件是不是路径写错了

0
莫铭
莫铭

报错信息显示不能实例化ledgerAction,后面有个ClassNotFoundException的异常,应该是你的配置文件配置的类的路径有问题。

配置文件中配置类的时候,记得加上相应的包名。

比如LedgerAction.java在com.example.action下,那配置的时候就应该配置 com.example.action.LedgerAction。

0
whatwhowhy
whatwhowhy
配置文件贴出来。应该是你的配置文件配置的类的路径有问题。
0
苏别v
苏别v
确实 看一下配置文件里面的类路径就找到了
返回顶部
顶部