为了账号安全,请及时绑定邮箱和手机立即绑定

PageNotFound:1136 - 在名为“spring”的 DispatcherServlet

PageNotFound:1136 - 在名为“spring”的 DispatcherServlet

慕雪6442864 2023-10-12 17:00:26
当我单击welcome.jsp 中的任何链接时,我收到警告 PageNotFound:1136 - 在 DispatcherServlet 中,名称为“spring”的 URI [/CATestSlotBooking/show] 未找到 HTTP 请求的映射。下面是控制器类@Controllerpublic class BookingSlotController {@RequestMapping(value = "/show", method = RequestMethod.GET)public String showBookingPage(ModelMap model) {    BookingSlotVO bookingDetailsVO = new BookingSlotVO();    model.addAttribute("bookingSlotVO", bookingDetailsVO);    return "booking";}调度程序 servlet MXL<?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:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsd"><context:annotation-config />    <context:component-scan base-package="com.cts" /><bean id="viewResolver"  class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="prefix" value="/WEB-INF/views/" /><property name="suffix" value=".jsp" /></bean><bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"><property name="defaultLocale" value="en" ></property></bean><mvc:interceptors><bean id="localChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"><property name="paramName" value="lang" /></bean></mvc:interceptors></beans>
查看完整描述

1 回答

?
BIG阳

TA贡献1859条经验 获得超6个赞

<welcome-file-list>从 web.xml 中删除。


更新后web.xml:


<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns="http://java.sun.com/xml/ns/javaee"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

id="WebApp_ID" version="2.5">

<display-name>OnlineTestSlotBooking</display-name>

<servlet>

    <servlet-name>spring</servlet-name>

    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

    <load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

    <servlet-name>spring</servlet-name>

    <url-pattern>/</url-pattern>

</servlet-mapping>


</web-app>


查看完整回答
反对 回复 2023-10-12
  • 1 回答
  • 0 关注
  • 66 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信