springmvc-config.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:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
https://www.springframework.org/schema/mvc/spring-mvc.xsd"> <!-- 1,自动扫描包,让指定包下的注解生效,由IOC容器统一管理 -->
<context:component-scan base-package="com.wukaka.controller"/>
<!-- 2,支持mvc注解驱动-->
<mvc:annotation-driven /> <!-- 3,让Spring MVC不处理静态资源 -->
<mvc:default-servlet-handler /> <!-- 4,视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
id="internalResourceViewResolver">
<!-- 前缀 -->
<property name="prefix" value="/WEB-INF/jsp/" />
<!-- 后缀 -->
<property name="suffix" value=".jsp" />
</bean> </beans>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<!--1.注册DispatcherServlet-->
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--关联一个springmvc的配置文件:【servlet-name】-servlet.xml-->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc-config.xml</param-value>
</init-param>
<!--启动级别-1-->
<load-on-startup>1</load-on-startup>
</servlet> <!--/ 匹配所有的请求;(不包括.jsp)-->
<!--/* 匹配所有的请求;(包括.jsp)-->
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- 解决post乱码 -->
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param> </filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

[springmvc] - 配置文件 springmvc-config.xml 和 web.xml的更多相关文章

  1. Eclispe创建maven工程缺失web.xml报web.xml is missing and <failOnMissingWebXml> is set to true的错误

    Eclispe创建maven工程缺失web.xml报web.xml is missing and <failOnMissingWebXml> is set to true的错误,一看,还缺 ...

  2. 每天学会一点点(spring-mvc.xml与web.xml配置文件)

    1.spring-mvc.xml中拦截器的使用 首先在springMVC.xml配置如下代码: <!-- 拦截器 --> <mvc:interceptors> <bean ...

  3. SpringMVC 常用applicationContext.xml、web.xml、servlet-mvc.xml简单配置

    在进行学习配置文件之前,为了加深对框架的认识,简单的做了SSM框架的简单实验.然后画出listAll查询方法的整个过程的思维导图. 整个过程中的web.xml.SpringMVC.xml.applic ...

  4. springmvc.xml,context.xml和web.xml

    1:springmvc.xml配置要点 一般它主要配置Controller的组件扫描器和视图解析器 下为:springmvc.xml文件 <?xml version="1.0" ...

  5. Maven-SSM项目pom.xml配置以及springmvc配置以及mybatis配置及web.xml配置

    一.Maven本地仓库的pom.xml配置 (全部是mysql数据库) <project xmlns="http://maven.apache.org/POM/4.0.0" ...

  6. SSM的XML和WEB.XML的配置

    显示层(handler/controller): request请求到springmvc的前端控制器,从处理器映射器找相应的handler(用@RequestMapping("  " ...

  7. applicationContext.xml和web.xml的一些配置

    applicationContext.xml <!-- test环境 --> <beans profile="test"> <context:prop ...

  8. struts2中struts.xml和web.xml文件解析及工作原理

    web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp ...

  9. pom.xml出现web.xml is missing and <failOnMissingWebXml> is set to true解决方案

    提示信息应该能看懂.也就是缺少了web.xml文件,<failOnMissingWebXml>被设置成true了. 搜索了一下,Stack Overflow上的答案解决了问题,分享一下. ...

  10. pom.xml中web.xml is missing and <failOnMissingWebXml> is set to true错误的解决

    .personSunflowerP { background: rgba(51, 153, 0, 0.66); border-bottom: 1px solid rgba(0, 102, 0, 1); ...

随机推荐

  1. 算法1:Fibonacci数列

    斐波那契数列(Fibonacci) 一.背景介绍 斐波那契数列(Fibonacci sequence),又称黄金分割数列,因数学家莱昂纳多·斐波那契(Leonardo Fibonacci)以兔子繁殖为 ...

  2. python tkinter 使用(七)

    python tkinter 使用(七) 本篇文章主要讲下tkinter 中的message 控件. Message控件可以用于在窗口中显示一段文本消息. 以下是个简单的例子: #!/usr/bin/ ...

  3. MinIO客户端之alias

    MinIO提供了一个命令行程序mc用于协助用户完成日常的维护.管理类工作. 官方资料 mc alias mc alias list mc alias remove mc alias set mc al ...

  4. SpringBoot-MybatisPlus-Dynamic(多数据源)-springboot-mybatisplus-dynamic-duo-shu-ju-yuan-

    title: SpringBoot-MybatisPlus-Dynamic(多数据源) date: 2021-05-07 13:58:06.637 updated: 2021-12-26 17:43: ...

  5. Luogu P5515 [MtOI2019]灵梦的计算器

    简化题意 给定三个实数 \(n, a, b\),求方程 \(\left \lfloor {x ^ a + x ^ b} \right \rfloor = \left \lfloor {n ^ a + ...

  6. LeetCode 分治篇(50、17)

    50. Pow(x, n) 实现 pow(x, n) ,即计算 x 的 n 次幂函数. 示例 1: 输入: 2.00000, 10 输出: 1024.00000 示例 2: 输入: 2.10000, ...

  7. 华为云GaussDB以技术创新引领金融行业分布式转型

    摘要:分布式数据库以大集群规模.弹性伸缩等优异特性,满足了银行业务发展的多种需求,也因此成为各大银行关键基础设施技术创新建设的首选. 今天,由北京先进数通与华为联合主办的"银行业数字化转型实 ...

  8. U2Net基于ModelArts Notbook的仿真实验

    摘要:U2Net是一个优秀的显著性目标检测算法,由Qin Xuebin等人发表在Pattern Recognition 2020期刊[Arxiv].U2Net名称的来源在于其网络结构由两层嵌套的Une ...

  9. 详解MRS CDL整体架构设计

    摘要:MRS CDL是FusionInsight MRS推出的一种数据实时同步服务,旨在将传统OLTP数据库中的事件信息捕捉并实时推送到大数据产品中去,本文档会详细为大家介绍CDL的整体架构以及关键技 ...

  10. 应用传送网络(ADN):率先架起“东数西算”的“高速公路”

    摘要:云原生ADN网络的未来,是公有云Internet接入降成本的手段,以及对自建光纤骨干网的补充,有力地支撑 "东数西算"国家新基建布局. 本文分享自华为云社区<华为云顾炯 ...