struts.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>
   <!--  value值爲true的時候爲開發模式,修改的內容立即生效。不用重啓tomcat -->
   <constant name="struts.devMode" value="true" /> 
   <!-- package name 的作用是防止action name 重名;namespace 決定了action的訪問路徑,默認爲" ",可以接受所有路徑的action -->

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

 

Namespace

1、namespace決定了action的訪問路徑,默認爲" ",可以接受所有路徑的action

2、namespace可以寫爲/, 或者/xxx,或者/xxx/yyy,對應的action的路徑爲/index.action,/xxx/index.action,/xxx/yyyindex.action

3、namespace最好用模塊來命名


 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章