java - 在 intellij 中运行 tomcat 时,Java servlet 找不到我的 index.jsp
问题描述
我使用intellij。
好的,tomcat 正在运行,一切正常,但是离开给我一个 404 错误。
我的 web.xml 位于项目根目录的 webcontent 文件夹中。项目文件夹/WebContent/WEB-INF
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
<display-name>WebTicket</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
我的页面位于:projectfolder/WebContent
那么在项目属性中,项目方面是 web。
我使用 servle + maven。
任何 Ideia 如何解决它?
问题可能出在文件夹结构中,如果更改项目方面应该解决,我在某处读过,但是该怎么做呢?
解决方案
出色地。我将项目创建为 Dynamic Web Module 到 2.5 并更改为 4.0
2.5中Web资源的默认文件夹是projectfolder/src/main/webapp
在 4.0 中是 projectfolder/WebContent
当我在 Eclipse 中更改项目属性中的方面时,旧配置仍然存在。
在intellij中只需进入文件>项目结构
facets 选项卡,选择 Web 模块并更改 Web Resources 文件夹。
推荐阅读
- javascript - Javascript JSON 从值中获取 id
- java - 使用 lettuce 响应式命令订阅 redis 频道 (pubsub)
- audiokit - 除了使用包络之外,还有什么方法可以避免在停止/启动 AKOscillator 时出现振幅咔嗒声
- python - 不理解时间序列上 numpy.correlate 的结果
- azure - 带有 Msal for Angular 6 的多租户 Azure Active Directory 应用程序
- svn - 从 BDB SVN 存储库中恢复源代码
- c - 如何在 C 中使用 fork() 制作倾斜树?
- python - 如何使用 python 3 的 anaconda 安装 rpy2 以在同一个 jupyter 笔记本中运行 R 和 Python?
- c++ - 为什么我的石头剪刀布游戏无法运行?
- html - 如何更改特定日期或季节的图像