簡體   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