springmvc中controller路由出现404

java\]springmvc中controller路由出现404 ## problem \[java\]springmvc中controller路由出现404 ## reason 可能原因有很多 * idea配置不对 * 编译配置不对 * xml配置 * jsp位置 ## solution 1. 核对idea配置 mac: idea-\>File -\> Project Structure ![Snipaste_2023-12-27_11-16-25](https://file.jishuzhan.net/article/1741330681247567874/57255515e1e0a200abc48350a511fea1.webp) 最重要的是 Artifacts,默认配置不对需要手动添加lib包 ![Snipaste_2023-12-27_11-19-06](https://file.jishuzhan.net/article/1741330681247567874/7a5f574f55342f0f65e1066108160c4c.webp) 2. 核对编译配置 mac: idea -》Run -》Edit Configurations -》 点绿色的+号,选择 tomcat--\>local -》出现弹窗 弹窗配置server * name: tomcat8 * application server: 选择tomcat 的安装目录 * URL: 改为 http://localhost:8080/ 默认是 http://localhost:8080/spring02_mvc_war_exploded/ 弹窗配置Deployment * 点击 + 号 * 选择: Artifact... * 选择完成后,中间区域出现 spring02-mvc:war exploded * Application context: / 默认是 /spring02_mvc_war_exploded ![Snipaste_2023-12-27_11-06-32](https://file.jishuzhan.net/article/1741330681247567874/d8a3a78685247909f507fb7bda57aead.webp) 3. xml配置 ```xml dispatcher / ``` 4. jsp配置 * 配置文件: web/WEB-INF/dispatcher-servlet.xml * JSP 根据配置存放jsp文件配置 ```xml // // /template/ .jsp ``` ![Snipaste_2023-12-27_11-39-47](https://file.jishuzhan.net/article/1741330681247567874/23e1eb9e2661bfd812c651c6e5d0fdec.webp)

相关推荐
一诺加油鸭1 天前
若依后端系统集成 Swagger 接口文档功能
java·开发语言
云烟成雨TD1 天前
Spring AI Alibaba 1.x 系列【40】多智能体核心模式 - 智能体作为工具(Agent as Tool)
java·人工智能·spring
测试员周周1 天前
【踩坑系列3】飞书机器人集体“失联“?3 个 Gateway 进程让我差点崩溃!一个测试老兵的排查实录
java·python
aq55356001 天前
Laravel9.x新特性全解析
java·开发语言·数据库
亦暖筑序1 天前
AI 客服系统升级实战:多 Agent 路由 + 多轮记忆 + 敏感词过滤
java·后端
zhangzeyuaaa1 天前
深入理解 Python GIL:从机制到释放时机
java·网络·python
河阿里1 天前
Spring AOP:企业级实战教学
java·后端·spring
lagrahhn1 天前
IDEA一些提效的方法
java·ide·intellij-idea
yuanpan1 天前
Python Scrapy 入门教程:从零学会抓取和解析网页数据
java·python·scrapy
Bat U1 天前
JavaEE|多线程(五)
java·开发语言·jvm