<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. 已知空间三个点,解算外接圆圆心坐标,C++编程实现

    struct PT3 { double x, y, z; }; int solveCenterPointOfCircle(std::vector<PT3> pt, double cente ...

  2. [LeetCode] Water and Jug Problem 水罐问题

    You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...

  3. [LeetCode] Rectangle Area 矩形面积

    Find the total area covered by two rectilinear rectangles in a2D plane. Each rectangle is defined by ...

  4. [LeetCode] Isomorphic Strings 同构字符串

    Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the chara ...

  5. Backbone.js应用基础

    前言: Backbone.js是一款JavaScript MVC应用框架,强制依赖于一个实用型js库underscore.js,非强制依赖于jquery:其主要组件有模型,视图,集合,路由:与后台的交 ...

  6. Service实时向Activity传递数据案例

    转自 http://www.cnblogs.com/linjiqin/p/3147764.html 演示一个案例,需求如下:在Service组件中创建一个线程,该线程用来生产数值,每隔1秒数值自动加1 ...

  7. php 使用函数中遇到的坑之----list

    1. list 把数组中的值赋给一些变量 <?php $info = array('coffee', 'brown', 'caffeine'); // 列出所有变量 list($drink, $ ...

  8. 机器学习笔记-----AP(affinity propagat)算法讲解及matlab实现

    大家好,我是人见人爱,花见花开的小花.哈哈~~! 在统计和数据挖掘中,亲和传播(AP)是基于数据点之间"消息传递"概念的聚类算法.与诸如k-means或k-medoids的聚类算法 ...

  9. JAVA源码分析-HashMap源码分析(一)

    一直以来,HashMap就是Java面试过程中的常客,不管是刚毕业的,还是工作了好多年的同学,在Java面试过程中,经常会被问到HashMap相关的一些问题,而且每次面试都被问到一些自己平时没有注意的 ...

  10. express之sendFile

    module.exports = function(req, res, opt) { var applyNo = req.query.applyNo; console.log("applyN ...