这篇文章我们讲的是映射器,映射器的作用是什么样的请求交给Action,如果我们没有在xml配置文件中进行配置,默认的就是BeanNameUrlHanderMapping.

我们讲一个案例增加用户的案例.

案例结构图如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX8AAAFOCAIAAADhAIo4AAAgAElEQVR4nO2dbXQUVYL3yw/zbT9wDp7j7oc947gu6nCeh0eGZN1+XAfHeZ7gumd9jnPGgbNDeHG3VsSRlxlHMholQCBGWVshA4oiLIgNJIhGekBkgIMgZDMQECRDb8irJnS6YyfppKvTgXo+VHfVvVW3XpJ06q3/v3M/dN269dLB+nnv7ap/cRd7RLIc+tO3Wz6oFwub18v/sbsv3d2XXr91/31zlnb3CaIocrdtnLr2ivSBvVkkGAznPgU4Ppz9IH2iF+QGdHMxzHOBYESulT6HedU+sk3IxjqfI8FAgOcD5Cp5V+Fgrpb6DvKJKbthVmraZ5eok9NUGJxtmCf2BAoBDvbRsuF3j3XFhK64cN+cpUsr3u6KpeVV3O3b/mLZeb0NwzyXJXsdRYIBjufVtWO0T9Y5HMdxXCAY5MdgH1p/9K50LnVmA0alUqWsyMkmzHOkuTg+DPsALbAPgzWr/qk9KrT3pjp6hY5eoSOakurl7o9laMvkBXXvAwCvAvswePm3/9x2I9V6I9WWK+PdU17sEwkG5H0QvYo8oPTVDLtDAEwKsA+DF3/zuKpI9dxtG7k7do5lT3nq+xCjHPR7gG+AfQAAzgD7AACcAfYBADgD7AMAcAbYBwDgDLAPAMAZYB8AgDMUkH1WPHiH06eQV4hnqPKEo7dR5//rALfjZ/scX3P/yd/9D7ls+vn3ycXja+53+gQnhtvto3nEzLz5uI5O3IqJe7W9hZ/tc/KF6ZHj2785t/ObczvP739t+/K55OLJF6Y7fYJuI6/2iQQDgYDZnd4Tvxc8zFNP1MI/XsKr9jl+/HhVVZVJm+d/+M25nen+o/GLe64e3rJ9+Vxy8fjzP7TnVL1DPu0jPaFv9tx6foVBpAIAL+BJ+xw7dmz69OnTpk0zbnZ0x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vIJh1YF18p4B8Bf+tM+enRu6YumuWHrqXbNl+/zr8g1yA6N4ZhP70JPLQdVsDzVPzAhm1tqH3B8xDc3IewbAX/jTPrver26PCu1RQerySGV37VFprSvimY2GUxhqgYLAn/Z5/92NrTeE1hvC7tqjsnpabwhOn5eC4a3OsA8oCPxpn23vvPHf3SltkdY6HM+cHWgZ6AX2AQWBP+2zdeubzOL0eQEAFPxpHwCA+4F9AADOAPsAAJwB9gEAOIPD9kHUKQAFi5P2sRp1CgDwI7ba52JdmVxEUQwdbbYUdTqpuDbh1M+5ZWeOlFe3iKIYDYXKlzRGnT4dis7GzSVHnL4TvkCwzz5NtWX04qpJiTodK76yj/zEGL0lkVNkTMu+kprykpp9Z6SLsIahhjNHyktqNof62DuQtpJLdQu7WZ7t07JPOucsfSeXkGeoWjQD9qHI/icxhj/gGPj/JuXKidAMjJ0AAAAASUVORK5CYII=" alt="" />

对上面的案例结构进行说明:

1. UserAction.java是增加用户的Action。

2.SpringMvc_002.xml是对应这个案例的配置文件。

3.Spirngmvc.xml是总的配置文件。

4.index.jsp是项目默认的访问页面。

5.succss.jsp是成功的访问页面。

第一步:写UserAction.java.

代码如下:

package com.guigu.shen.Action2;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller; public class UserAction implements Controller { @Override
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView modelAndView=new ModelAndView();
modelAndView.addObject("message", "增加了一个用户");
modelAndView.setViewName("success"); return modelAndView;
} }

第二步:写SpringMvc_002.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.0.xsd http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
>
<!-- 控制器(程序员)(必须配置) -->
<bean name="/adduser.action" class="com.guigu.shen.Action2.UserAction"></bean>
<!-- 如果Action汇总书写的是视图逻辑名称,那么视图解析器就必须配置(解释一下什么是视图逻辑名称:就是类似Struts2中的,"success")
如果Action中配置的是视图真实名称,那么视图解析器就可选配置(解释一下什么是视图真实名称,就是"/jsp/success.jsp")
-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置路径前缀 -->
<property name="prefix" value="/jsp/"></property>
<!-- 配置路径后缀 -->
<property name="suffix" value=".jsp"></property>
<!-- 上面的配置方法其实就是前缀+视图逻辑名+后缀=真实路径 -->
</bean>
</beans>

第三步:写总的配置文件

<?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.0.xsd http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
>
<import resource="com/guigu/shen/Action2/springmvc_002.xml"/>
</beans>

第四步:写index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head> <body>
This is my JSP page. <br>
<a href="${pageContext.request.contextPath}/adduser.action">增加用户</a>
</body>
</html>

对于上面的<a href="${pageContext.request.contextPath}/adduser.action">增加用户</a>我要重点解释一下。这么写的话,用火狐调试出来的访问路径是:

http://127.0.0.1:8080/SpringMvc_10day_self/adduser.action。但是如果改为<a href="/adduser.action">那么访问路径是:http://127.0.0.1:8080/adduser.action

。${pageContext.request.contextPath}这句话是访问绝对路径。也就是相当于/SpringMvc_10day_self。

第五步:写success.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head> <body>
Success. <br>
${message}
</body>
</html>

第六步:配置web.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>SpringMvc_10day_self</display-name>
<servlet>
<!--这个名字可以随便取得,但是这个名字取了之后,以后在 WEB-INF下面创建SpirngMVC的配置文件是,命名必须以这个开头, 所以这里取名叫做DispatcherServlet,那么之后的xml文件取名必须为DispatcherServlet-servlet.xml(一个字都不能差) -->
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class> org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- 通知DispatcherServlet去指定目录下找到springmvc.xml配置文件 -->
<!--
注意这里的 <param-name>contextConfigLocation</param-name>一个字母都不能有错
一旦有错就会去WEB-INF下面去找
-->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>*.action</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
</web-app>

调试:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWIAAACmCAIAAABvMBI7AAAgAElEQVR4nO2da1wUV57363mz++p5tS/2s/PiWSRv/Izz4O7O7Oxmk5mIFyabnUnIhc1MWCIiAibxFk1HBZoWoYEwBk1GARWiCAYVuUhAUYEGVBCdIIgMIMq1abqBvtH3RntfVHf1qapTdbq5NTD/7+f3ovvUOadOVdf/V/9zqlBKZXCqDM5xvWNMZx+dsvYr9Vdu3v9B8aNaO2NxvDDZybI4XkzqzdfvPCq90do3phudso7p7ON6B90zCARa6aLGDU6l3jGqs49MWR8NqIpr7t7p6DPZZn0xCJZss/cfP8surDxxofpM2e2z5fUF5fWFFQ0LpZMXr19regQCgZZelFLnGNM6RiatfWO67yoVP/5lyGx/MWObi8z2F4+fjRdWND4d1Sq19gm9U21waoyzC6L8K7dmAQA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Kq3VHqsYmahOxdx6pZCxaIg9QkgE0AwCqEnE3UJOQVHCuhjSO9wsVd1/TfJvxZmwCbAIDAM++1CcgmAGC149vaBAteNuGJ6kWyCVjCBIDAQnogSgKN6poE2gLEbYL9OJNgE8QXJSCbAIBFR8QmBO/kaFjWJGR7kg7GHYRtorN6l39rEzxbAQBgycHaREvBxuz0Cvy6gGdmQYPe7X2wCdaDVU+JSDbBykQAAAgMLJvwLFvSN3AfsglW2JNtoiaB94alqE2wJyAAAAQG9nsTrJgkZxPIjMOFTBAE3sLsrN7FX2jA2gQyi4F1BwAIOCJ/IUrKJjx/7uF9L4u7SOFyubzZBP7Riccm0Oev7rb8GQoAAIHAaxPklcXlrQCeRABY3cC/NwEAAAGwCQAACIBNAABAAGwCAAACYBMAABAAmwAAgADYBAAABMAmAAAgADYBAAABsAkAAAiATQAAQABsAgAAAmATAAAQAJsAAIAA2AQAAATAJgAAIAA2AQAAAbAJAAAIgE0AAEAAbAIAAAJgEwAAEACbAACAANgEAAAEwCYAACAANgEAAAGwCQAACIBNAABAAGwCAAACYBMAABAAmwAAgADYBAAABMAmAAAgADYBAAABsAkAAAiATQAAQABsAgAAAmATAAAQAJsAAIAA2AQAAATAJgAAIAA2AQAAAbAJAAAIgE0AAEAAbAIAAAJgEwAAEACbAACAANgEAAAEwCYAACAANkjsG94AAAA1SURBVAEAAAGwCQAACIBNAABAAGwCAAACYBMAABAAmwAAgADYBAAABMAmAAAgADYBAACB/wVHoUSRfR+TTwAAAABJRU5ErkJggg==" alt="" />

运行结果:对的。

总结一下执行的流程:

浏览器发送请求。然后默认进入了index.xml。然后点击增加用户的按钮,发送了一个Action请求,因为web.xml中的配置,该请求被DispatcherServlet拦截下来。

然后找到了springmvc_002.xml配置文件,创建了里面的bean实例(com.guigu.shen.Action2.UserAction;InternalResourceViewResolver)。接着根据

映射器(BeanNameUrlHandlerMapping)找到了/adduser.action请求对应的UserAction对象,然后执行里面的handleRequest方法,最后再根据视图解析器(InternalResourceViewResolver)找到success.jsp页面。并把数据显示出来。

04SpringMvc_映射器_BeanNameUrlHanderMapping的更多相关文章

  1. SpringMVC入门案例及请求流程图(关于处理器或视图解析器或处理器映射器等的初步配置)

    SpringMVC简介:SpringMVC也叫Spring Web mvc,属于表现层的框架.Spring MVC是Spring框架的一部分,是在Spring3.0后发布的 Spring结构图 Spr ...

  2. Spring映射器、适配器、解析器

    1 springmvc的映射器和适配器 1.1springmvc的映射器 根据客户端请求的url,找到处理本次请求的handler(处理器),将url和controller关联起来 1.2spring ...

  3. 05SpringMvc_映射器SimpleUrlHanderMapping

    这篇文章讲的还是映射器,映射器类有两种,前一篇文章讲的是BeanNameUrlHanderMapping映射器类.今天讲的是SimpleUrlHanderMapping映射器类. 这两个映射器类有什么 ...

  4. Mapper映射器

    在两个独立的对象之间建立通信的对象 需要在两个必须相互隔离的子系统间建立通信. 可能是因为无法修改已有的子系统,或者不愿意在两者之间建立依赖关系.甚至不愿意这两个子系统与另一个部件间建立依赖关系. 运 ...

  5. springmvc03 非注解和注解处理器映射器和适配器

    1其它非注解处理器映射器和适配器 .1BeanNameUrlHandlerMapping(映射器) 根据请求url(XXXX.action)匹配spring容器bean的 name 找到对应的bean ...

  6. SpringMVC中注解和非注解方式下的映射器和适配器总结

    1. 非注解方式 1.1 处理器适配器 上一节中使用的处理器适配器是:org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapte ...

  7. [jbdj]SpringMVC框架(3)映射器

    映射器:什么样的请求交给Action. 1} class  :  BeanNameUrlHandlerMapping  要掌握, 将程序员定义的Action所对应的<bean>标签的nam ...

  8. SpringMVC handleMapping 处理器映射器 属性清单

    映射器的属性清单 defaultHandler         在映射与所有处理器都不匹配的情况下,指定默认的处理器(处理器即你定义的Controller(action)类) order        ...

  9. SpringMVC的映射器、适配器、解析器

    1.处理器和适配器 1.1springmvc的映射器 根据客户端请求的url,找到处理本次请求的handler(处理器),将url和controller关联起来 1.2springmvc的适配器 对映 ...

随机推荐

  1. ABAP常用函数集锦

    函数名 描述 SD_VBAP_READ_WITH_VBELN 根据销售订单读取表vbap中的信息EDIT_LINES 把READ_TEXT返回的LINES中的行按照TDFORMAT=“*”重新组织VI ...

  2. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q127-Q130)

    Question 127You create a custom list named Products.You need to perform a Representational State Tra ...

  3. Android线程池(一)

    本篇文章主要介绍Android自带的线程池的使用. 首先要引入线程池的概念 线程池:是一种多线程处理形式,处理过程中将任务添加到队列,然后在创建线程后自动启动这些任务. 线程池线程都是后台线程.每个线 ...

  4. iOS中的单例模式

    概念相关 单例模式 在程序运行过程,一个类只有一个实例 使用场合 在整个应用程序中,共享一份资源(这份资源只需要创建初始化1次) static static关键字会在声明变量的时候分配内存,在程序运行 ...

  5. IOS开发--常用工具类收集整理(Objective-C)(持续更新)

    前言:整理和收集了IOS项目开发常用的工具类,最后也给出了源码下载链接. 这些可复用的工具,一定会给你实际项目开发工作锦上添花,会给你带来大大的工作效率. 重复造轮子的事情,除却自我多练习编码之外,就 ...

  6. canvas & animation

    1.using canvas using canvas to set difference property. it will showing like an animation. The true ...

  7. Effective Java 20 Prefer class hierarchies to tagged classes

    Disadvantage of tagged classes 1. Verbose (each instance has unnecessary irrelevant fields). 2. Erro ...

  8. Effective Java 69 Prefer concurrency utilities to wait and notify

    Principle Use the higher-level concurrency utilities instead of wait and notify for easiness. Use Co ...

  9. 【mysql】使用脚本对mysql状态进行监控

    1.mysqladmin 使用mysqladmin extended-status命令可以获得所有MySQL性能指标,即show global status的输出,不过,因为多数这些指标都是累计值,如 ...

  10. 最完整PHP.INI中文版

    ;;;;;;;;;;;;;;;;;;; 关于php.ini ;;;;;;;;;;;;;;;;;;;; 这个文件必须命名为'php.ini'并放置在httpd.conf中PHPINIDir指令指定的目录 ...