解决SSM:No mapping found for HTTP request with URI [路径] in DispatcherServlet with name ‘dispatcherServ

本文档主要介绍了在SSM框架中遇到的'No mapping found for HTTP request with URI'错误,详细分析了错误原因,并提供了从index.jsp到controller再到list的跳转过程。重点强调了web.xml中springmvc前端控制器的配置,以及dispatcherServelt-servlet.xml文件中<mvc:default-servlet-handler/>和<mvc:annotation-driven/>的重要性。错误排查集中在dispatcherServelt-servlet.xml的正确配置上。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

No mapping found for HTTP request with URI [路径] in DispatcherServlet with name 'dispatcherServlet

跳转过程:
在这里插入图片描述

  1. index.jsp 里面跳转到 “/emps”

在这里插入图片描述

  1. 来到controller控制器,返回list

在这里插入图片描述
上面是web.xml配置的springmvc前端控制器

<?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:tx="http://www.springframework.org/schema/tx"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
 
		<!-- springmvc配置文件,包含网站的跳转逻辑的控制 -->
		<context:component-scan base-package="com.zzf" use-default-filters="false">
			<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
		</context:component-scan>
		
		<!-- 配置视图解析器 -->
		<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
			<property name="prefix" value="/WEB-INF/views/"></property>
			<property name="suffix" value=".jsp"></property>
		</bean>
		
		<!-- 两个标准配置 -->
		<mvc:default-servlet-handler/>
		<mvc:annotation-driven/>
</beans>

上面是dispatcherServelt-servlet.xml文件

<mvc:default-servlet-handler/>
<mvc:annotation-driven/>这两个配置很重要

我的错误是文件名字有问题,在上面的前端控制器中,进入到dispatcherServelt-servlet.xml
在这里插入图片描述

然后看/WEB-INF/views/list.jsp

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

小胖丨学编程

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

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

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

打赏作者

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

抵扣说明:

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

余额充值