Structs2配置文件明明已经配置了action,可总提示访问不到

J2EE 码拜 10年前 (2015-05-10) 772次浏览 0个评论
 

配置文件struts.xml

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

<struts>
   <constant name="struts.custom.i18n.resources" value="message"></constant>
   <constant name="struts.i18n.encoding" value="UTF-8"></constant>
    <package name="json_default" namespace="/" extends="json-default" >  
     <action name="pro" class="action.Citys" method="getData">
     <result type="json">  
        <param name="includeProperties">province,citys</param>      
     </result>
     </action>    
     </package>
  <package name="default" namespace="/" extends="struts-default"> 
  <interceptors>
  <interceptor name="test" class="interceptor.Test"></interceptor>
  <interceptor-stack name="myStack">
  <interceptor-ref name="defaultStack"></interceptor-ref>
  <interceptor-ref name="test"></interceptor-ref>
  </interceptor-stack>
  </interceptors>
   <action name="login" class="action.LoginAction" method="login">   
            <result >
               /loginSuccess.jsp
            </result>
        </action> 
     <action name="secret">   
            <result >
               /secret.jsp
            </result>
            <result name="login">
               /Login.jsp
            </result>
            <interceptor-ref name="myStack"></interceptor-ref>
      </action>
       <action name="login" class="action.LoginAction" method="login">   
            <result >
               /loginSuccess.jsp
            </result>
        </action> 
      </package>
      
</struts>

错误信息
警告: Could not find action or result
There is no Action mapped for namespace [/] and action name [pro] associated with context path [/Structs2_3]. – [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
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:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
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:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)

20分
你确定请求的是ajax里的pro.action?

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Structs2配置文件明明已经配置了action,可总提示访问不到
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!