zoukankan      html  css  js  c++  java
  • 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>
    

      

  • 相关阅读:
    Session cookie 原理
    asp.net core service mesh
    js 常用库
    asp.net core consul
    asp.net core polly
    asp.net core ocelot
    第十五章 享元模式 Flyweight
    第十四章 策略模式 Strategy
    mysql 主从复制
    mysql 执行计划
  • 原文地址:https://www.cnblogs.com/zjsy/p/4194779.html
Copyright © 2011-2022 走看看