spring mvc配置文件不能识别<mvc:default-servlet-handler⼀> 标签是缺少什么jar包

2025-04-06 16:05:39
推荐回答(2个)
回答1:

“spring mvc”配置文件缺少“dispatcher-servlet.xml”这个文件,建议删除全部文件然后重新操作一遍即可。

“SpringMVC”的相关问题解析:

(1)访问路径URL是否正确被“spring mvc”拦截;

(2)检查配置正确性;“Base-package”的后面如果是写成了”com.taotao.controller.*”是错误的(不带*,定位到包即可。);

(3)只有成功读取到“spring mvc”的"xml配置文件,才能让"spring容器加载"spring mvc容器,才能识别“@Controller”注解并执行标注的“Contoller”层;

(4)“web.xml”加载"spring容器“xml”的配置文件时,之间的“contextConfigLocation”也是固定的。

回答2:

你的beans标签下的xsi:schemaLocation有没有这两个:

http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd