0

我在管理文件夹中有一个 Login.jsp 页面。现在,当用户访问 Admin 文件夹时,登录页面应该是第一个执行的。

下面是我的项目目录结构。

在此处输入图像描述

如何在 web.xml 中进行配置,以便当我访问 Admin 文件夹时将执行 Login.jsp 而不是 index.jsp

web.xml 的内容如下所示

<display-name>RealCMS</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
4

1 回答 1

0

首先,我认为您不应该为您的管理文件夹提供对用户的直接访问权限。您可以为 admin 文件夹中的所有 jsp 页面进行映射,而不是这样做。如果这是一个没有任何框架的简单应用程序,您可以简单地配置 web.xml 中的所有 jsp 页面以映射到适当的 url。如果使用像 struts 这样的框架,您可以使用模块配置。

根据你的问题试试这个。

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>login.jsp</welcome-file>
</welcome-file-list>
于 2013-03-15T04:15:03.890 回答