ITPub博客

首页 > > > java sping mvc404 问题

java sping mvc404 问题

作者:abcjob 时间:2019-09-25 14:09:13 0 删除 编辑

dispatcher-servlet.xml 文件配置

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

xmlns:context="http://www.springframework.org/schema/context"

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">

<!--component-scan就是告诉Servlet去哪里找到相应的Controller-->
<context:component-scan base-package="controllers"/>

<!--视图解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <!-- 视图的路径 -->
    <property name="prefix" value="/WEB-INF/View/Hello/"/>
    <!-- 视图名称后缀  -->
    <property name="suffix" value=".jsp"/>
</bean>
</beans>

问题补充:错误提示:

04-Sep-2018 17:00:11.140 警告 [http-apr-9999-exec-10] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/Hello/index] in DispatcherServlet with name 'dispatcher'

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4798/viewspace-3165113/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-10-12

  • 博文量
    159
  • 访问量
    6868