请问:Struts2如何映射个人路径?

问题描述:
例如:http://www.123.com/mumu(用户名)/archive/.....
Struts2如何实现呢,映射如何动态定位到个人资源啊!

        哪位大神能详细说说具体的实现步骤

http://blog.csdn.net/rsun1/article/details/8171352
url重写

用户名相当于一个参数

我的javaeye原创博客:
Struts2配置文件映射动态路径,真正实现“零手工”配置 编辑
http://jjk-02027.iteye.com/blog/2269359

[size=large][color=blue]1:先上配置[/color][/size]
[code="xml"]




pojo,map,arr,frontPageName,jdata



json
true

false

/common/{1}/{1}_modify.jsp
/common/{1}/{1}_modify.html
/common/{1}/{1}_browse.jsp
/common/{1}/{1}_browse2.jsp
/common/{1}/{1}_browse3.jsp

        <result name="mig_modify">/migcommon/{1}/{1}_modify.jsp</result>
        <result name="mig_modify2">/migcommon/{1}/{1}_modify2.jsp</result>
        <result name="mig_browse">/migcommon/{1}/{1}_browse.jsp</result>
        <result name="mig_browsepara">/migcommon/{1}/{1}_browsepara_${controlId}.jsp</result>
        <result name="common_modify">/migcommon/${frontPageName}/${frontPageName}_modify.jsp</result>
        <result name="common_browse">/migcommon/${frontPageName}/${frontPageName}_browse.jsp</result>
        <result name="common_modify2">/migcommon/${foldName}/${frontPageName}.jsp</result>
        <result name="common_browse2">/migcommon/${foldName}/${frontPageName}.jsp</result>
        </action>
</package>

[/code]

[color=red][size=large]2:解释[/size]:
   使用*来动态匹配,{1}代表第一个*号的值,{2}代表第二个*号的值[/color]

[size=large][color=blue]3:DEMO:[/color][/size]
eg1:
[url]http://localhost:8080/migration/curd/migAuditvConfigCURDadd.action[/url]
  根据配置会调用migAuditvConfigCURDAction的add方法。
  注(一般是migAuditvConfig.java类的add方法,如果集成了spring就是调用id为migAuditvConfig的bean的add方法)
 add方法返回SUCCESS会走默认配置返回JSON数据类型的值。

eg2: [url]http://localhost:8080/migration/curd/migAuditvConfigCURDmodify.action[/url]  
 根据配置会调用migAuditvConfigCURDAction的modify方法。
 modify方法返回SUCCESS会走默认配置返回JSON数据类型的值。

eg3:[url]http://localhost:8080/migration/curd/migAuditvConfigCURDbrowse.action[/url]
 根据配置会调用migAuditvConfigCURDAction的browse方法。
 browse方法返回SUCCESS会走默认配置返回JSON数据类型的值。

eg4:[url]http://localhost:8080/migration/curd/migAuditvConfigCURDdelete.action[/url]
 根据配置会调用migAuditvConfigCURDAction的delete方法。
 delete方法返回SUCCESS会走默认配置返回JSON数据类型的值。

eg5:[url]http://localhost:8080/migration/curd/migAuditvConfigCURDinitModify.action[/url]
 根据配置会调用migAuditvConfigCURDAction的initModify方法。
 initModify方法返回"mig_modify"会走name="mig_modify"的配置页面跳转到
/migcommon/{1}/{1}_modify.jsp页面,即:
[url]http://localhost:8080/migration/migcommon/migAuditvConfig/migAuditvConfig_modify.jsp[/url]

eg6:[url]http://localhost:8080/migration/curd/migAuditvConfigCURDbrowseDynamic.action?foldName=fold1&frontPageName=page1[/url]
 根据配置会调用migAuditvConfigCURDAction的browseDynamic方法。
 browseDynamic方法返回"common_browse2"会走name="common_browse2"的配置页面跳转到/migcommon/${foldName}/${frontPageName}.jsp页面,即:
[url]http://localhost:8080/migration/migcommon/fold1/page1.jsp[/url]

 <package name="curd" namespace="/curd" extends="json-default">
        <action name="*CURD*" class="{1}CURDAction" method="{2}">
            <result type="json">
                <param name="excludeProperties">
                    pojo,map,arr,frontPageName,jdata
                </param>
            </result>
            <result name="json" type="json">
                <param name="root">json</param>
                <param name="noCache">true</param>  
                <param name="ignoreHierarchy">false</param>
            </result>
            <result name="modify">/common/{1}/{1}_modify.jsp</result>
            <result name="modify2">/common/{1}/{1}_modify.html</result>
            <result name="browse">/common/{1}/{1}_browse.jsp</result>
            <result name="browse2">/common/{1}/{1}_browse2.jsp</result>
            <result name="browse3">/common/{1}/{1}_browse3.jsp</result>

            <result name="mig_modify">/migcommon/{1}/{1}_modify.jsp</result>
            <result name="mig_modify2">/migcommon/{1}/{1}_modify2.jsp</result>
            <result name="mig_browse">/migcommon/{1}/{1}_browse.jsp</result>
            <result name="mig_browsepara">/migcommon/{1}/{1}_browsepara_${controlId}.jsp</result>
            <result name="common_modify">/migcommon/${frontPageName}/${frontPageName}_modify.jsp</result>
            <result name="common_browse">/migcommon/${frontPageName}/${frontPageName}_browse.jsp</result>
            <result name="common_modify2">/migcommon/${foldName}/${frontPageName}.jsp</result>
            <result name="common_browse2">/migcommon/${foldName}/${frontPageName}.jsp</result>
            </action>
    </package>