[英]how to call index.jsp as default when Run my application
我創建了一個Web動態項目,並在WebContent文件夾下創建了一個文件夾作為視圖名稱。 我將index.jsp文件保留在視圖文件夾中。
我想要這樣做,以便在運行應用程序時默認情況下將顯示索引頁面。 將其保留在webcontent文件夾中時會工作,但是當我將其放入view文件夾中時會收到錯誤消息(頁面不可用)
如何在Eclipse中解決此問題?
都很簡單,您可以通過添加以下標記在web.xml文件中對其進行配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>name you want to see</display-name>
<welcome-file-list>
<welcome-file>view/yourFile.jsp</welcome-file>
</welcome-file-list>
</web-app>
並且它將在運行您的應用程序時作為首頁加載
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.