2 wangchuanzhi710 wangchuanzhi710 于 2016.03.31 13:54 提问

spring mvc 执行后tomcat总是显示 No mapping....为什么???

为什么总是出现下图的问题,该怎么解??
图片

2个回答

CSDNXIAON
CSDNXIAON   2016.03.31 14:02

Spring 3 MVC No mapping found for HTTP request with URI (转)
spring mvc No mapping found for HTTP request with URI [] in DispatcherServlet
Spring MVC No mapping found for HTTP request with URI
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

qq_31506961
qq_31506961   2016.03.31 14:06

web.xml: log4jConfigLocation WEB-INF/log4j.properties

 <servlet>
    <servlet-name>controller</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring-controller.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>controller</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.css</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.gif</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.jpg</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.js</url-pattern>
</servlet-mapping>

spring-config.xml:

errors/error errors/err

spring-controller.xml:



/context:component-scan




spring-hibernate.xml:

```<!-- 配置hibernate SessionFactory-->
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">



org.hibernate.dialect.MySQLDialect
update
true
true



<!-- 这里为SessionFactory配置了实体bean的自动扫描 -->

com.gujiaqi.bean


class="org.springframework.orm.hibernate4.HibernateTransactionManager">





Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!