課程
/后端開發
/Java
/JAVA遇見HTML——Servlet篇
用的是2016Myeclipse,創建了一個Servlet,可是在WEB-INF→lib沒有對應的web.xml文件,想知道在哪里打開對應的web.xml文件。
2018-03-18
源自:JAVA遇見HTML——Servlet篇 1-14
正在回答
我的意思是, 如果沒有這個xml 就自己創建, 這個問題不大, 至于xml 文件前面有兩句聲明,?
以下是一個空的 xml? 模板, 去已有的其他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>demo</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>
</web-app>
慕粉3922146 提問者
手動在 WEB-INF 文件夾下創建 web.xml 文件.
至于模板,可以去 tomcat 安裝目錄下面的 conf/web.xml 下面復制內容, 然后刪掉注釋以及無關內容
自己再配置就行了
不過 好像創建servlet 的時候 myeclipse 有個提示框 (生成 web.xml) 你應該是忘記勾選了
qq_快樂就好_19
舉報
本門課程在JSP課程的基礎上,深入介紹Servlet的基礎知識
2 回答servlet在web.xml中注冊
1 回答eclipse創建servlet不自動配置web.xml怎么回事,在創建servlet之前就有web.xml文件了
5 回答自動生成的web.xml,不能自動配置<servlet>和<servlet-mapping>
2 回答可不可以在servlet中也使用JSP中直接匹配的方法呢?可以的話應該在哪里寫...servlet類中不能寫對吧...
5 回答對于servlet的問題-.-
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-03-19
我的意思是, 如果沒有這個xml 就自己創建, 這個問題不大, 至于xml 文件前面有兩句聲明,?
以下是一個空的 xml? 模板, 去已有的其他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>demo</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>
</web-app>
2018-03-18
手動在 WEB-INF 文件夾下創建 web.xml 文件.
至于模板,可以去 tomcat 安裝目錄下面的 conf/web.xml 下面復制內容, 然后刪掉注釋以及無關內容
自己再配置就行了
不過 好像創建servlet 的時候 myeclipse 有個提示框 (生成 web.xml) 你應該是忘記勾選了