最近这几天我在配置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
当我们遇到“Spring MVC No Session found for current thread”的错误时,这通常意味着在尝试访问HttpSession对象时,当前线程没有找到相关的session。这个问题可能是由于多种原因导致的,包括配置错误、过滤器设置...
404-PageNotFound, "404 Page Not Found" 页面的精选列表 找不到 404页 那些无聊 404页的灵感库。访问画廊墙,并选择你喜欢的 !问题大多数情况下,"找不到 404"页被积压所忽略。 但我们知道 ! 事实上,你会面临...
在WebLogic中,你可以使用Java API for WebSocket (JSR 356)来创建WebSocket服务端和客户端的端点。 首先,我们需要创建一个WebSocket服务器端点类。这个类需要实现`javax.websocket.Endpoint`接口,并通过`@...
No mapping found for HTTP request with URI [/mypaltform/user] in DispatcherServlet with name 'dispatcher' 暂时认为是配置文件有问题(但是我觉得没问题啊... 感冒了,不想工作... 白天在改吧) Log4j的配置也有...
<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. ...
SpringMVC:No mapping found for HTTP request with URI [/account/*] in DispatcherServlet with 在使用 SpringMVC 时,可能会出现请求映射错误。解决方法是,检查 Controller 中的请求映射,确保正确,并且确保...
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 ...
在Spring Boot应用中,我们经常需要处理HTTP请求的映射,包括无业务逻辑的简单跳转和静态资源的访问。本文将围绕标题和描述中提到的问题进行深入解析,特别是当使用`addViewController()`方法实现无业务逻辑跳转时...
ZenCart URL目录式链接Ceon Url Mapping SEO插件,这款插件也是大家比较喜欢的,唯一的缺点就是不自动生成友好的url,需要你手动填写url,去后台分类,产品处单击更新下才能生成,现在官方有支持zencart 1.5的,强创...