日期:2014-05-20  浏览次数:20675 次

struts2 default-action-ref 的问题
Java code
<struts>

    <constant name="struts.devMode" value="true" />

    <package name="base" namespace="/" extends="struts-default">
        <default-action-ref name="index"></default-action-ref>
        <action name="index" class="com.luger.blog.action.BlogAction"
            method="blogIndex">
            <result>/blogIndex.jsp</result>
        </action>
    </package>

    <package name="article" namespace="/" extends="base">
        <!-- <default-action-ref name="Blog--blogIndex"></default-action-ref> -->
        <action name="*--*" class="com.luger.blog.action.{1}Action"
            method="{2}">
            <result>
                /{1}--{2}.jsp
            </result>
        </action>
    </package>

</struts>



一直找不到默认页

------解决方案--------------------
启动报错了呢。
“ <!-- <default-action-ref name="Blog--blogIndex"></default-action-ref> -->”

改了
------解决方案--------------------
在 <package name="article"/>里面加入<default-action-ref name="index"></default-action-ref
------解决方案--------------------
你是想找默认页?
 <default-action-ref name="index"></default-action-ref>的意思是什么也不输入,只有项目名字时候,会默认访问index这个action。可以把它注释掉,同一楼。
你想找页面的话去web.xml文件里面看看这里写得什么。
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
 </welcome-file-list>
 
------解决方案--------------------
貌似*-*和default-action-ref有冲突吧。。。
记得以前看视频上这么说的。。