WUXIAOLIANG2 2017-06-07 04:01 采纳率: 0%
浏览 2595
已结题

DispatcherServlet noHandlerFound

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

<!-- Erp -->


contextConfigLocation
classpath*:spring/applicationContext-*.xml


characterEncodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8


forceEncoding
true



characterEncodingFilter
/*


org.springframework.web.context.ContextLoaderListener


org.springframework.web.util.IntrospectorCleanupListener


springmvc
org.springframework.web.servlet.DispatcherServlet

contextConfigLocation
classpath*:spring/springmvc-servlet.xml

1


springmvc
/


30


index


403
/error/403.html


404
/error/404.html


500
/error/500.html

springmvc-servlet.xml
<?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"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"

default-autowire="byName" default-lazy-init="false">

<!-- 配置静态文件请求,不经过Spring Dispatcher Servlet
(PS:该标签是spring 3.0.4新增的,而目前还没有相应的schema,因此编辑器里面会提示mvc:resource标签未定义) -->
<mvc:resources location="/js/" mapping="/js/**/*"/>
<mvc:resources location="/css/" mapping="/css/**/*"/>
<mvc:resources location="/image/" mapping="/image/**/*"/>
<mvc:resources location="/error/" mapping="/error/**/*"/>
<mvc:resources location="/upload/" mapping="/upload/**/*"/>
<mvc:resources location="/widgets/" mapping="/widgets/**/*"/>
<mvc:resources location="/robots.txt" mapping="/robots.txt"/>
<mvc:resources location="/favicon.ico" mapping="/favicon.ico"/>

<!-- 自动搜索指定包目录下的,@Controller,@Component标注的Bean类 
    context:component-scan 会隐式地注册AutowiredAnnotationBeanPostProcessor、
    CommonAnnotationBeanPostProcessor,所以在某种程度上可以把context:annotation-config移除掉
-->

<context:component-scan base-package="java" use-default-filters="false">
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>   

<bean class="org.springframework.web.servlet.mvc.annotation.annotationMethodHandlerAdapter">
    <property name="messageConverters">
        <list>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <property name="supportedMediaTypes">
                    <list>
                        <value>text/plain;charset=UTF-8</value>
                    </list>
                </property>
            </bean>
        </list>
    </property>
</bean>

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"></bean>

<bean id="freemarkerConfiguration" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    <property name="location" value="classpath:config/ftl.properties"/>
</bean>

<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
    <property name="templateLoaderPath" value="/WEB-INF/ftl/" />
    <property name="freemarkerSettings" ref="freemarkerConfiguration"/>

</bean>

<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
    <property name="order" value="1"/>
    <property name="prefix" value=""/>
    <property name="suffix" value=".ftl"/>
    <property name="contentType" value="text/html;charset=utf-8"/>
    <property name="cache" value="true" />

    <property name="exposeSpringMacroHelpers" value="true" />
    <property name="requestContextAttribute" value="request" />

    <property name="exposeRequestAttributes" value="true" />
    <property name="exposeSessionAttributes" value="true" />

    <property name="viewClass">
        <value>org.springframework.web.servlet.view.freemarker.FreeMarkerView</value>
    </property>
</bean>

<bean id="jasperResolver" class="org.springframework.web.servlet.view.jasperreports.JasperReportsViewResolver">
    <property name="order" value="2" />
    <property name="prefix" value="/WEB-INF/jasper/" />
    <property name="suffix" value=".jasper" />

    <property name="viewClass" value="org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView" />

    <property name="exporterParameters">
        <map>
            <entry key="net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING">
                <value>utf-8</value>
            </entry>
        </map>
    </property>

    <property name="headers">
        <props>
            <prop key="Content-Disposition">attachment;</prop>
        </props>
    </property>

</bean>

<bean class="org.springframework.web.servlet.view.XmlViewResolver"
        p:location="/WEB-INF/jasper/jasper-views.xml" p:order="0"
></bean>


console:
信息: Server startup in 4949 ms
六月 07, 2017 11:43:24 上午 org.springframework.web.servlet.DispatcherServlet noHandlerFound
警告: No mapping found for HTTP request with URI [/Erp/] in DispatcherServlet with name 'springmvc'
六月 07, 2017 11:43:24 上午 org.springframework.web.servlet.DispatcherServlet noHandlerFound
警告: No mapping found for HTTP request with URI [/Erp/error/404.html] in DispatcherServlet with name 'springmvc'![图片说明](https://img-ask.csdn.net/upload/201706/07/1496807975_868152.png)图片说明

  • 写回答

2条回答 默认 最新

  • laogao01200 2017-06-07 09:10
    关注

    是没加 @Service @comtroller的原因么

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?