m0_37663286
面向窗外
2017-08-27 10:49

Struts2 action匹配的问题

  • struts

struts.xml之前是这么写的 list join delete
分别对应stu-list stu-delete stu-join stu-delete
list和delete都可以找到action
join就找不到action

 <package name="default" namespace="/" extends="struts-default">
        <action name="stu-*" class="studentAction" method="{1}">
            <result name="list">/WEB-INF/views/stu-list.jsp</result>
                <result name="join">/WEB-INF/views/stu-join.jsp</result>
            <result name="delete" type="redirect">/stu-list</result>
        </action>
</package> 

万般无奈,只好改成了如下 倒是能用了 但是我很疑惑为什么找不到action

 <package name="default" namespace="/" extends="struts-default">
        <action name="stu-*" class="studentAction" method="{1}">
            <result name="list">/WEB-INF/views/stu-list.jsp</result>
            <result name="delete" type="redirect">/stu-list</result>
        </action>

        <action name="stu-join" class="studentAction" method="join">
            <result name="join">/WEB-INF/views/stu-join.jsp</result> 
        </action>
</package>

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换