[springmvc] - 配置文件 springmvc-config.xml 和 web.xml
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的更多相关文章
- 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的错误,一看,还缺 ...
- 每天学会一点点(spring-mvc.xml与web.xml配置文件)
1.spring-mvc.xml中拦截器的使用 首先在springMVC.xml配置如下代码: <!-- 拦截器 --> <mvc:interceptors> <bean ...
- SpringMVC 常用applicationContext.xml、web.xml、servlet-mvc.xml简单配置
在进行学习配置文件之前,为了加深对框架的认识,简单的做了SSM框架的简单实验.然后画出listAll查询方法的整个过程的思维导图. 整个过程中的web.xml.SpringMVC.xml.applic ...
- springmvc.xml,context.xml和web.xml
1:springmvc.xml配置要点 一般它主要配置Controller的组件扫描器和视图解析器 下为:springmvc.xml文件 <?xml version="1.0" ...
- Maven-SSM项目pom.xml配置以及springmvc配置以及mybatis配置及web.xml配置
一.Maven本地仓库的pom.xml配置 (全部是mysql数据库) <project xmlns="http://maven.apache.org/POM/4.0.0" ...
- SSM的XML和WEB.XML的配置
显示层(handler/controller): request请求到springmvc的前端控制器,从处理器映射器找相应的handler(用@RequestMapping(" " ...
- applicationContext.xml和web.xml的一些配置
applicationContext.xml <!-- test环境 --> <beans profile="test"> <context:prop ...
- struts2中struts.xml和web.xml文件解析及工作原理
web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp ...
- pom.xml出现web.xml is missing and <failOnMissingWebXml> is set to true解决方案
提示信息应该能看懂.也就是缺少了web.xml文件,<failOnMissingWebXml>被设置成true了. 搜索了一下,Stack Overflow上的答案解决了问题,分享一下. ...
- 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); ...
随机推荐
- 若依vue启动报Error: error:0308010C:digital envelope routines::unsupported
解决:若依vue启动报Error: error:0308010C:digital envelope routines::unsupported 1.描述: 问题产生原因是因为 node.js V17版 ...
- 如何屏蔽各大AI公司爬虫User Agent
罗列各大AI公司Scraper爬虫Crawler使用的User Agent,教您如何在robots.txt里面屏蔽这些爬虫的访问,禁止它们下载您的网站内容以训练 AI 模型,保护数据,降低带宽,防止宕 ...
- ElasticSearch之cat master API
命令样例如下: curl -X GET "https://localhost:9200/_cat/master?v=true&pretty" --cacert $ES_HO ...
- vulnhub - Fawks - writeup
信息收集 目标开放了21的ftp有匿名登录,除此之外还有常规的80,和连个ssh的端口. 80端口的是一张图片,就是哈利波特的海报图. anonymous空密码登上去有一个文件下载下来是二进制的文件 ...
- docker: 'buildx' is not a docker command
解决方法 sudo apt install docker-buildx-plugin
- 深入理解JavaScript堆栈、事件循环、执行上下文和作用域以及闭包
1. 堆栈 在JavaScript中,内存堆是内存分配的地方,调用栈是代码执行的地方. 原始类型的保存方式:在变量中保存的是值本身,所以原始类型也被称之为值类型. 对象类型的保存方式:在变量中保存的是 ...
- 心理健康数据集:mental_health_chatbot_dataset
一.数据集描述 1.数据集摘要 该数据集包含与心理健康相关的问题和答案的对话对,以单一文本形式呈现.数据集是从流行的医疗博客(如WebMD.Mayo Clinic和HealthLine).在线常见 ...
- 案例解析丨金蝶K/3 Wise接入华为云RDS数据库SQL Server
1. 简介 企业或用户将数据中心部署在线下,采用独立软件提供商(Independent Software Vendor)软件进行管理.线下数据运维成本较高,故障容灾单一化,是目前遇到的瓶颈.采用云上数 ...
- openGauss内核:简单查询的执行
摘要:本文主要分析简单查询语句在业务处理线程Postgres上的执行流程,并介绍如何利用gdb梳理代码逻辑. 本文分享自华为云社区<openGauss内核分析(二):简单查询的执行>,作者 ...
- 干掉 Navicat! 一款数据分析师必备的数据库可视化工具
数据开发,离不开数据库,一款优秀的数据库开发和管理工具可以达到事半功倍的效果.市面上比较流行的数据库管理工具主要有Navicat.DBeaver.SQLyog等等,Navicat是其中的无冕之王,其拳 ...