【问题标题】:Call action in web.xml file in Struts 2.3在 Struts 2.3 中调用 web.xml 文件中的操作
【发布时间】:2015-05-05 02:09:13
【问题描述】:

这是默认实现。

<welcome-file-list>
    <welcome-file>Index.jsp</welcome-file>
 </welcome-file-list>

我想像下面这样改变

 <welcome-file-list>
    <welcome-file>login.action</welcome-file>
 </welcome-file-list>

<action name="login" class="com.mm.authentication.Login">
        <result name="success">/Index.jsp</result>

上面的实现不起作用。

如果有人知道怎么做,请告诉我。

【问题讨论】:

标签: struts2


【解决方案1】:

欢迎文件只是一个文件。您必须将其重命名为 login.jsp。但是创建一个新文件index.jsp,内容如下

<% response.sendRedirect(request.getContextPath()+"login.action"); %> 

动作配置

<action name="login" class="com.mm.authentication.Login">
    <result name="success">/login.jsp</result>

【讨论】:

    猜你喜欢
    • 2014-01-26
    • 1970-01-01
    • 2023-03-04
    • 2014-03-25
    • 1970-01-01
    • 2015-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多