最近这几天我在配置springMVC项目的时候遇到了一个问题,在网上也找了一下试过了,但是还是不能够解决。
主要是我配置好了之后我访问首页,在console端缺No mapping found for HTTP request with URI [/] in DispatcherServlet with name,始终没有找到原因,请大家帮我看一下我哪里是不是配置有问题呀:
web.xml
<servlet>
<servlet-name>taoziShop</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:taoziShop-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>taoziShop</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
,然后我再src下面写了一个配置文件如下:
taoziShoop-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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<!-- 向spring中注入默认注解映射处理器以及把指定控制包下面的控制层注入到spring中 -->
<mvc:annotation-driven />
<mvc:default-servlet-handler/>
<context:annotation-config/>
<context:component-scan base-package="com.taoziShop.ebiz">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<mvc:resources location="/static/js" mapping="/js/**"/>
<mvc:resources location="/static/images" mapping="/images/**"/>
<mvc:resources location="/static/css" mapping="/css/**"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
<property name="prefix" value="/WEB-INF/view/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>
我的控制器是这么写的:
package com.taoziShop.ebiz.action;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class IndexController {
@RequestMapping(value={"/","/index.do"})
public String toHomePage(ModelMap modelMap) throws Exception {
List<Integer> numList = new ArrayList<Integer>();
for (int index = 0; index <= 10; index++) {
numList.add(index);
}
modelMap.addAttribute("numList", numList);
return "index";
}
}
,希望大家帮我看看就是出现什么问题,每次访问首页好像找不到相应的控制层。
相关推荐
delphi 2010升级到xe8后,decodestring汉字出现:No mapping for the.mht
404-PageNotFound, "404 Page Not Found" 页面的精选列表 找不到 404页 那些无聊 404页的灵感库。访问画廊墙,并选择你喜欢的 !问题大多数情况下,"找不到 404"页被积压所忽略。 但我们知道 ! 事实上,你会面临...
No mapping found for HTTP request with URI [/mypaltform/user] in DispatcherServlet with name 'dispatcher' 暂时认为是配置文件有问题(但是我觉得没问题啊... 感冒了,不想工作... 白天在改吧) Log4j的配置也有...
可以在weblogic下开发的websocket完整示例,希望对你有用,谢谢!
Bump mapping is a normal-perturbation rendering technique for simulating lighting effects caused by patterned irregularities on otherwise locally smooth surfaces. By encoding such surface patterns in ...
Gmapping SLAM原始论文《Improved Techniques for Grid Mapping with Rao-Blackwellized Particle Filters》,大家可以详细阅读,有需要的可以下载。同时可以参照博客...
<mime-mapping> <extension>htm</extension> <mime-type>text/html;charset=gb2312</mime-type> </mime-mapping> <mime-mapping> <extension>html</extension> <mime-type>text/html;charset=gb2312</mime-...
request_mapping import request_mapping@ request_mapping ( "/user" )class UserView ( View ): @ request_mapping ( "/login/" , method = "post" ) def login ( self , request ): data = request . POST return...
// 2005-JAN-10 - Thanks to Don Beusee for pointing out the danger in mapping // length-checked formatting functions to non-length-checked // CRT equivalents. Also thanks to him for motivating...
UEStudio and UltraEdit provide a way for you to search and delete found lines from your files. This short tutorial provides the steps for searching for and deleting lines by writing a simple script. ...
effective SNR mapping for modeling frame error rates in multiple-state channels 3GPP2
Simultaneous Localization and Mapping for Mobile Robots: Introduction and Methods Simultaneous Localization and Mapping for Mobile Robots: Introduction and Methods
DOCTYPE hibernate-configuration (View Source for full doctype...)> - <!-- Generated by MyEclipse Hibernate Tools. --> - - <property name="myeclipse.connection.profile">oracle.jdbc.driver.Oracle...
ComponentOne has partnered with Esri, the leading online map and GIS provider, to bring you the best mapping tools and UI controls together in one package. Easily transform GIS data into business ...
ComponentOne has partnered with Esri, the leading online map and GIS provider, to bring you the best mapping tools and UI controls together in one package. Easily transform GIS data into business ...
ComponentOne has partnered with Esri, the leading online map and GIS provider, to bring you the best mapping tools and UI controls together in one package. Easily transform GIS data into business ...
ComponentOne has partnered with Esri, the leading online map and GIS provider, to bring you the best mapping tools and UI controls together in one package. Easily transform GIS data into business ...
Disease Mapping with WinBUGS and MLwiN provides a practical introduction to the use of software for disease mapping for researchers, practitioners and graduate students from statistics, public health ...
ZenCart URL目录式链接Ceon Url Mapping SEO插件,这款插件也是大家比较喜欢的,唯一的缺点就是不自动生成友好的url,需要你手动填写url,去后台分类,产品处单击更新下才能生成,现在官方有支持zencart 1.5的,强创...
Use the latest presentation model or MVVM (Model-View-ViewModel) design patterns in your applications with ComponentOne Studio for WPF. Each control supports dependency properties, complete XAML ...