问题描述
Unabletoloadconfiguration.-action-file:/D:/eclipse%20luna/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/Stru_12/WEB-INF/classes/struts.xml:13:71atorg.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:501)atorg.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)atorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)atorg.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)atorg.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)atorg.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)atorg.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4594)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5201)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)atorg.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)atjava.util.concurrent.FutureTask$Sync.innerRun(UnknownSource)atjava.util.concurrent.FutureTask.run(UnknownSource)atjava.util.concurrent.ThreadPoolExecutor.runWorker(UnknownSource)atjava.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)atjava.lang.Thread.run(UnknownSource)代码:publicclassServiceimplementsServiceIp{publicStringadd(Useru){//TODOAuto-generatedmethodstubStringsql="insertintouser(username,password)values(?,?)";Stringmessage=null;Connectionconn=null;conn=DBUtil.getConnection();PreparedStatementpst=null;try{pst=conn.prepareStatement(sql);pst.setString(1,u.getUsername());pst.setString(2,u.getPassword());pst.execute();}catch(SQLExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();returnmessage="error";}returnmessage="add";}publicvoiddelete(intid){}publicvoidupdate(intid){//TODOAuto-generatedmethodstub}}action中:publicclassUserActionextendsActionSupport{/****/privatestaticfinallongserialVersionUID=1L;Stringmessage=null;privateUseru;privateServiceservice;publicUsergetU(){returnu;}publicvoidsetU(Useru){this.u=u;}publicStringadd(){service.add(u);if(message=="add"){return"addSuccess";}else{return"addError";}}}struts.xml中<constantname="struts.enable.DynamicMethodInvocation"value="false"/><constantname="struts.devMode"value="true"/><packagename="default"namespace="/"extends="struts-default"><actionname="plus"class="com.action.UserAction"method="add"><resultname="addSuccess">/success.jsp</result><resultname="addError">/error.jsp</result></action></package>
解决方案
解决方案二:
struts.xml:13:71自己去找下文件13行就知道啥错误了。
解决方案三:
看看struts.xml:13:71