j解决方案

请高手告诉我:我在struts.xml 文件放在scr目录下,我又在scr目录下。创建了个包,然后Struts.xml 调用那个包里的XML文件,我写的包里面的那个文件内容为。

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts> 
 <package name="web-user" extends="web-manager-default" namespace="/user">
  <action name="toLogin">
   <result name="success">/web/user/user.jsp</result>
   <result name="error">/web/user/user.jsp</result>
  </action>
  <action name="addUserLogin" class="com.charity.web.action.user.UserAction" method="addUserLogin">
   <result name="success">/web/user/user.jsp</result>
   <result name="error">/web/user/user.jsp</result> 
  </action>
  <action name="toMessage">
      <result name="success">/web/user/userSendinfo.jsp</result>
   <result name="error">/web/user/userSendinfo.jsp</result>
  </action>
  <action name="addMessage" class="com.charity.web.action.msg.MessageAction" method="addMessage">
   <result name="success">/web/user/userSendinfo.jsp</result>
   <result name="error">/web/user/userSendinfo.jsp</result>
  </action>
 </package>

但它运行出来还是报错。。

错误为:

信息: Server startup in 4254 ms
[web] 2010-05-26 11:30:21,031 - org.apache.struts2.dispatcher.Dispatcher -9891 [http-8081-1] ERROR org.apache.struts2.dispatcher.Dispatcher  - Could not find action or result
There is no Action mapped for namespace /user and action name toMessage. - [unknown location]
 at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
 at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
 at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
 at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:595)
我是新手,但不知道怎么解决,请高人回答!谢谢

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭