<init-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:applicationContext.xml</param-value>
 </init-param>

路径:1,src目录下 2,src\main\resources目录下

②不使用classpath

<param-value>/WEB-INF/applicationContext.xml</param-value>

③不写<init-param>时

<servlet>

<servlet-name>dispatch</servlet-name>

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

</servlet>

默认为xxx-servlet.xml,默认路径为/WEN-INF/xxx-servlet.xml(XXX为servlet-name即是:dispatch)

即是:dispatch-servlet.xml

另:url路径问题

举例1:

  1. @Controller
  2. @RequestMapping("/welcome")
  3. public class HelloWorldController {
  4. @RequestMapping(value="/hello" ,method=RequestMethod.GET)
  5. public String printWelcome(ModelMap model){
  6. model.addAttribute("message" ,"Spring 3 MVC Hello World");
  7. return "hello";     }
  8. }
  9. url:http://localhost:8080/demo1/welcome/hello

举例2:

  1. @Controller
  2. public class HomeController {
  3. @RequestMapping("home")
  4. public String home(){
  5. return "home";  }
  6. }
  7. url:http://localhost:8080/demo1/home

web.xml

  1. </servlet>
  2. <servlet-mapping>
  3. <servlet-name>dispatch</servlet-name>
  4. <url-pattern>/</url-pattern>
  5. </servlet-mapping>

application.xml

  1. <context:component-scan base-package="com.vito.action" />
  2. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  3. <property name="prefix" value="/WEB-INF/jsp/" />
  4. <property name="suffix" value=".jsp" />
  5. </bean>

springMVC的配置文件路径问题的更多相关文章

  1. 3.SpringMVC修改配置文件路径和给界面传递数据

    1.修改配置文件路径  达到  配置多文件的目的 web.xml文件中基础配置有springMVC配置的servlet路径 <servlet-name>SpringMVC</serv ...

  2. (转)SpringMVC学习(三)——SpringMVC的配置文件

    http://blog.csdn.net/yerenyuan_pku/article/details/72231527 读者阅读过SpringMVC学习(一)——SpringMVC介绍与入门这篇文章后 ...

  3. springMVC访问根路径问题

    当web.xml没有配置欢迎页:如下 <welcome-file-list> <welcome-file>login.jsp</welcome-file> < ...

  4. Spring+SpringMVC整合----配置文件

    1.在 web.xml 中加载 spring 的配置文件 bean.xml    底层是 Listener <!-- Spring --> <context-param> &l ...

  5. springMVC项目配置文件

    一.springMVC项目配置文件 1.web.xml文件全局配置 <servlet> <servlet-name> dispatcher </servlet-name& ...

  6. 查看nginx配置文件路径

    进入nginx安装目录(我的是/usr/local/nginx-1.7.8/) 进入sbin目录,输入 ./nginx -t查看nginx配置文件路径以及该文件语法是否正确 ./nginx -v查看n ...

  7. thinkphp配置文件路径

    thinkphp配置文件路径在入口文件index.php中配置. 如果Public目录在应用程序目录同等级位置: 2.如果Public在app内部则: 3.如果使用Public在app外部,但定义为: ...

  8. c# 根据配置文件路径,设置和获取config文件 appSettings 节点值

    /// <summary> /// 获取编译后的主配置文件节点值 /// </summary> /// <param name="key">&l ...

  9. 关于springmvc的配置文件

    开发常用的springmvc.xml配置文件,spring 3.0 spring-servlet.xml配置. <?xml version="1.0" encoding=&q ...

随机推荐

  1. [LeetCode] Sentence Screen Fitting 调整屏幕上的句子

    Given a rows x cols screen and a sentence represented by a list of words, find how many times the gi ...

  2. [LeetCode] Combination Sum II 组合之和之二

    Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in ...

  3. C# 7.0 新功能代码范例

    随着新版本的IDE Visual Studio 15 紧锣密鼓的开发中,2016年8月24日,微软发布了与之配套的C# 7.0 preview 的新特性. 其主要特性有: 内联声明out变量 (Out ...

  4. H5是什么,CSS3又是什么?

    经常有客户咨询说你们会做H5吗,就像这个,拿过来一看,一个上下滑动的贺卡,这已经成为了大部分人对H5的理解,甚至很多大公司都推出了制作这种动画的工具,可以快速生成此类页面.(其实,这就用到了一些CSS ...

  5. geolocation/ 百度地图api Geolocation 定位当前城市信息

    根据当前所处位置 定位所在城市信息 <html> <head> <meta charset="UTF-8" /> <title>js ...

  6. echarts-在现实标题中显示百分比

    如图:需要在标题显示所占百分比 使用方式:途中标记部分 series : [{ name: '类型', type: 'pie', radius : '55%', center: ['50%', '60 ...

  7. 【Codeforces235C】Cyclical Quest 后缀自动机

    C. Cyclical Quest time limit per test:3 seconds memory limit per test:512 megabytes input:standard i ...

  8. bash的管道符与重定向

    管道符"|"可以用来将前面的程序的标准输出stdout(=1)重定向到后一个程序的stdin(=0),但是忽略了stderr. 在bash中使用2>&1 可以表示将s ...

  9. div内容溢出时显示滚动条

    在style中添加overflow:scroll属性即可.

  10. Day6-python基础之模块

    模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才 ...