老师课件上用了index.html页面打开了servlet的doGet和doPost方法,但我一直是404。
一开始我把.html放在根目录下,打不开
后来网上说在web.xml的< welcome-file-list>加上
< welcome-file>/WEB-INF/index.html< /welcome-file>同时把index.html放到WEB-INF里
http://localhost:8080/ServletTrain/ 直接打开了
然后我又把index.html放到WebContent里< welcome-file>index.html< /welcome-file>
http://localhost:8080/ServletTrain/ 和 http://localhost:8080/ServletTrain/index.html
都能打开
后来知道每次打开根目录会自动定向到< welcome-file-list>里第一个网页。
在servlet项目里加入并打开html页面
最新推荐文章于 2021-09-10 11:32:03 发布