struts2 中 namespace

 <package name="default" namespace="/" extends="struts-default">
  <action name="index_one">
   <result>/hello.jsp</result>
  </action>
 </package>

 <package name="default2" namespace="" extends="struts-default">
  <action name="index_one">
   <result>/hello2.jsp</result>
  </action>
 </package>

xml中同时有这两个配置,我的路径为http://localhost:8080/StrutsTwo/index_one,程序会访问第一个hello.jsp,因为 namespace="" 为默认的,namespace="/"代表写了路径符, 所以写了的比没写的优先级高。

仅代表我的理解,不晓得对不对?

猜你喜欢

转载自xiaoyuzhou.iteye.com/blog/1020544
今日推荐