Sring Web MVC web.xml中的配置
来源:互联网 发布:福建广电网络集团 缴费 编辑:程序博客网 时间:2024/05/21 00:18
在web.xml中配置前端控制器
<?xmlversion="1.0"encoding="UTF-8"?>
<web-appxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"version="2.5">
<display-name>Spring1st</display-name>
<!--配置前端控制器 -->
<servlet>
<servlet-name>spring_servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--contextConfigLocation是用来配置springmvc加载的配置文件(配置处理器、映射器、适配置) -->
<!-- 如果不配置contextConfigLocation,默认加载的是/WEB-INF/servlet名称-servlet.xml(spring_servlet.xml) -->
<init-param>
<!--在DispatcherServlet.class中: * <p>Calling {@link#setContextConfigLocation} (init-param 'contextConfigLocation') -->
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>spring_servlet</servlet-name>
<!-- url-pattern有两种配置方式
1. *.action,访问以.action结尾由DispatchServlet进行解析
*.html 只能响应html格式的请求。
2. / ,所有访问的地址都由DispatchServlet进行解析。对于静态文件的解析,需要配置不让DispatchServlet进行解析(比如jsp)。此方式可以实现RESTful风格的url
注意:不能使用 /*,因为最终在转发一个jsp页面时,仍然会由DispatchServlet解析jsp地址,不能根据jsp页面找到Handler,会报错
/*模式表示没有映射特定类型的响应,这会在处理图片或者样式css时带来不必要的麻烦。
-->
<url-pattern></url-pattern>
</servlet-mapping>
</web-app>
- Sring Web MVC web.xml中的配置
- Spring MVC web.xml配置
- web.xml中的配置
- web.xml中的配置
- 【spring MVC学习一】web.xml中的spring的配置
- Spring MVC 原子学习法 之 web.xml 中的配置
- 主讲spring mvc 在web.xml中的配置
- Spring mvc 在web.xml中的url-pattern配置
- 2.Sring Boot Web
- web.xml配置web中的key points
- web.xml中的一些配置
- web.xml 中的安全性配置
- SSH中的web.xml配置
- spring web.xml中的配置
- web.xml中的各种配置
- struts2中的web.xml配置
- web.xml中的相关配置
- Web.XMl中的各种配置
- 设计模式——抽象工厂模式
- 数组Array的方法
- node中的global、exports和module.exports
- Javascript偏函数与柯里化
- 爬虫之旅(二)
- Sring Web MVC web.xml中的配置
- 求二叉树叶子节点的个数 && 求第K层的节点个数
- Linux--一些基本命令
- UGUI研究院之UI粒子特效自适应缩放(二十二)
- MongoDB一(介绍及安装)
- 杨澜访谈录之探寻人工智能2(第三次浪潮)
- Cake
- 01背包问题
- English story 9