• Struts2的Action名称搜索顺序:2014.12.30


    struts.xml配置:

    <struts>
    	<package name="hw" namespace="/test" extends="struts-default">
    		<action name="helloworld" class="com.self.action.HelloWorldAction" method="dohelloworld">
    			<result name="doresult">
    				/WEB-INF/actionpage/showresult.jsp
    			</result>
    		</action>
    	</package>
    </struts>

    正确访问路径:http://localhost:8080/Struts2_01/test/helloworld

    如果浏览器访问路径:

    先访问路径:“http://localhost:8080/Struts2_01/test/aa/bb/cc/dd/helloworld”没找到!
    
    再访问路径:“http://localhost:8080/Struts2_01/test/aa/bb/cc/helloworld”也没找到!
    ...... 直到路径:“http://localhost:8080/Struts2_01/test/helloworld”找到了,返回界面显示

      

    如果还找不到:就到默认<package></package>里面找

    <!-- 默认配置:namespace属性为空 -->
    <package name="hw" namespace="" extends="struts-default">
    	<action name="helloworld" class="com.self.action.HelloWorldAction" method="dohelloworld">
    		<result name="doresult">
    			/WEB-INF/actionpage/showresult.jsp
    		</result>
    	</action>
    </package>
    

      

  • 相关阅读:
    泛型方法
    Javascript操作Cookie[3]
    委托的发展
    selectorUI元素状态伪类
    服务器端操作Cookie[2]
    泛型
    Action<T>泛型委托
    Javascript创建对象的流程
    Cookie[1]
    后缀名是exe的文件 的打开方式
  • 原文地址:https://www.cnblogs.com/zjsy/p/4194779.html
Copyright © 2020-2023  润新知