如何使用struts2映射Web应用程序的根路径?

时间:2017-02-03 01:05:29

标签: java struts2 struts-config

当我运行我的strust2 Web应用程序时,我想对根路径[/]执行一个操作。 这可能类似于没有名字的行动或只是"/",例如:

<action name="/" class="ControllerName" method="execute">
        <result name="success">ShowTheFirstPageAfterTheAction.jsp</result>
 </action>

1 个答案:

答案 0 :(得分:0)

...
<struts>
...
    <package name="user" namespace="/" extends="struts-default">
       <action name="" class="ControllerName" method="execute">
           <result name="success">ShowTheFirstPageAfterTheAction.jsp</result>
       </action>
       // Other actions depending on how you've designed your application
    <package
    // Other packages (also) depending on how you've designed your application
</struts>