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>
    
<constant name="struts.devMode" value="true" />

    
<package name="user" namespace="/user" extends="struts-default">
        
<default-action-ref name="index"></default-action-ref>
        
<!-- 全局结果集,本包内及继承自本包的Action可用 -->
        
<global-results>
            
<result name="mainpage">/mainpage.jsp</result>
        
</global-results>

        
<action name="index">
            
<result>/index.jsp</result>
        
</action>

        
<action name="r1" class="com.bebig.struts2.user.action.UserAction">
            
<result> /success.jsp</result>
            
<result name="error"> /error.jsp</result>
        
</action>

    
</package>

    
<!-- 继承自user包,因此可以使用user包的全局结果集 -->
    
<package name="admin" namespace="/admin" extends="user">
        
<action name="admin" class="com.bebig.struts2.user.action.AdminAction">
            
<result> /success.jsp</result>
        
</action>
    
</package>


</struts>