当前位置: 首页 > news >正文

SpringMVC中遇到的错误

SpringMVC中遇到的错误

  • 1.web.xml中配置SpringMVC核心类: DispatcherServlet 报错
    • 解决方案:添加Tomcat包
  • 2. not declaration can be found for element--------‘mvc:annotation-driven‘通配符的匹配很全面, 但无法找到元素 'mvc:annotation-driven' 的声明
    • 解决方案:模板有问题
  • 3.springMVC可以进入到控制器中,却无法返回页面错误404(前提保证代码没问题,控制台未报错)
    • 解决方法
  • 4.返回页面505报错 / 页面正常输出,但是控制台没有数据
    • 解决方法:加上注解@RequestParam
  • 5.SSM整合中出现 Controller中属性爆红 springmvc.xml中报MVC application context in module SSM. File is included in 4 contexts.
    • 解决方法

1.web.xml中配置SpringMVC核心类: DispatcherServlet 报错

在这里插入图片描述

解决方案:添加Tomcat包

第一步:点击File------->Project Structure
第二步:请添加图片描述
第三步:请添加图片描述

2. not declaration can be found for element--------‘mvc:annotation-driven‘通配符的匹配很全面, 但无法找到元素 ‘mvc:annotation-driven’ 的声明

idea显示:不能识别"mvc:annotation-driven/"这个标签
请添加图片描述
页面505
请添加图片描述
请添加图片描述

解决方案:模板有问题

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
​    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
​    xmlns:context="http://www.springframework.org/schema/context"
​    xmlns:mvc="http://www.springframework.org/schema/mvc"
​    xsi:schemaLocation="http://www.springframework.org/schema/beans
​    http://www.springframework.org/schema/beans/spring-beans.xsd 
​    http://www.springframework.org/schema/context 
​    http://www.springframework.org/schema/context/spring-context.xsd 
​    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

3.springMVC可以进入到控制器中,却无法返回页面错误404(前提保证代码没问题,控制台未报错)

解决方法

这时候,如果是基于maven管理的项目,可以在右侧打开maven,使用clean命令,将target文件清空,再使用install重新编译项目输出即可。

4.返回页面505报错 / 页面正常输出,但是控制台没有数据

在这里插入图片描述

解决方法:加上注解@RequestParam

5.SSM整合中出现 Controller中属性爆红 springmvc.xml中报MVC application context in module SSM. File is included in 4 contexts.

解决方法

第一步:点击File------->Project Structure
第二步:请添加图片描述
第三步:请添加图片描述

http://www.lryc.cn/news/2754.html

相关文章:

  • 姿态估计端到端新方案 | DirectMHP:用于全范围角度2D多人头部姿势估计
  • jvm学习的核心(五)---垃圾回收算法和常见垃圾回收器
  • 亿级高并发电商项目-- 实战篇 --万达商城项目 二(Zookeeper、Docker、Dubbo-Admin等搭建工作
  • 【C#基础】 C# 数据类型总结
  • 格子玻尔兹曼法介绍
  • 活动星投票在时间的河流上造园分组怎么设置如何进行分组报名
  • c#小笔记本-基础
  • DamiCMS SQL注入分析
  • 图傅里叶变换的推导和理解
  • Java八股文(Java面试题)
  • java ssm idea高校图书借阅管理系统设计2z87z
  • 电脑重装系统注册表恢复方法
  • 信道建模(大尺度、小尺度、莱斯衰落、瑞利衰落、莱斯信道、瑞利信道)
  • 2022年12月电子学会Python等级考试试卷(四级)答案解析
  • 通过实例告诉你lua中ipairs到底是怎么遍历的!
  • Axios异步请求 json格式
  • Postgresql源码(100)Portal与事务的关系(顶层事务与子事务)
  • Java、JSP企业快信系统的设计与实现
  • 1.2(完结)C语言进阶易忘点速记
  • 雅思经验(十一)
  • C++中的智能指针
  • LSTM已死,Transformer当立(LSTM is dead. Long Live Transformers! ):下
  • OJ万题详解––[NOIP2004 提高组] 合并果子(C++详解)
  • MySQL-字符集和比较规则
  • 微搭低代码从入门到精通12-网格布局
  • 【c语言】二叉树
  • 六、Java框架之SpringBoot
  • 「Python|环境安装|Windows」如何在Windows上安装Python环境?
  • 人工智能轨道交通行业周刊-第33期(2023.2.6-2.12)
  • 五分钟看懂Java字节码:极简手册