繁体   English   中英

配置web.xml以执行特定页面

[英]Configuring web.xml to execute particular Page

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

以下是我的Project目录结构。

在此处输入图片说明

如何在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>

首先,我认为您不应该为您的管理员文件夹提供直接访问用户的权限。 无需执行此操作,而是可以对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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM