maven ssm 项目404, 但是idea tomcat无法访问?spring-*.xml cannot be opened because not exist ? idea导入maven项目

7 篇文章 0 订阅
2 篇文章 0 订阅

前几天导入别人的maven项目 想看一看,结果一直报404是怎么回事呢?
导入maven项目方法:

在这里插入图片描述
在这里插入图片描述
接下来注意 有一步的右下角 environment setting, 保证自己的maven setting.xml文件和本地仓库路径没问题就好了。

导入成功后,观察java和resource文件夹是否为资源文件夹 静态资源文件夹
确保自己的web.xml没问题。
pom.xml build节点下加上

<resources>  
        <resource>  
            <directory>src/main/resources</directory>  
            <includes>  
                <include>**/*.properties</include>  
                <include>**/*.xml</include>  
                <include>**/*.tld</include>  
            </includes>  
            <filtering>false</filtering>  
        </resource>  
        <resource>  
            <directory>src/main/java</directory>  
            <includes>  
                <include>**/*.properties</include>  
                <include>**/*.xml</include>  
                <include>**/*.tld</include>  
            </includes>  
            <filtering>false</filtering>  
        </resource>  
    </resources> 

因为其它原因造成的 其实网上教程很多,这里总结容易忽视的:
检查项目的jsp是否放在webapps web-inf下面,
如果放在该目录,试图解析器的前缀要正确配置:
例如: /WEB-INF/jsp/ 表示web-inf下面jsp文件夹下的所有文件

配置没问题,tomcat启动404的原因,很可能是因为没正确设置默认页,或者默认页不存在,
例如:localhost:8080,其实默认是访问的localhost:8080/index.jsp,
但是页面不存在 或者页面在web-inf,自然无法访问,所以在web.xml 欢迎页的路径同样加上/web-inf/

如果仍有问题,很可能是导入的maven项目没有install, maven install一下就好了 。
在这里插入图片描述
如果是maven项目,右侧有个maven ,点进去找找就能看到install 。
至此 基本问题都能解决

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

孟秋与你

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值