SpringMvc后端往往前端
Spring的处理流程图
====================================================================================
1.先配置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_3_0.xsd"
id="WebApp_ID" version="3.0">
<!-启动时靠servlet来启动配置文件-->
<servlet>
<!-前端控制器-->
<servlet-name>springMVCServletDispatcher</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-默认找/web-inf/[servlet的名称]-servlet.xml-><init-param><param-name>contextConfigLocation</param-name><param-value>classpath*:spring-mvc.xml</param-value> <!-配置web.xml就配置spring-mvc.xml->
</init-param>
<load-on-startup>1</load-on-startup> <!-servlet一启动就加载->
</servlet> <servlet-mapping><servlet-name>springMVCServletDispatcher</servlet-name><url-pattern>/</url-pattern></servlet-mapping>
<!-- 添加springMVC注解支持 -->
<mvc:annotation-driven></mvc:annotation-driven>
<welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list>
</web-app>
2.配置前端控制器spring-mvc.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-4.3.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd"><!-- 在spring MVC中,只用管理控制器 -->
<context:component-scan base-package="com.rsy"> <!-- 管理控制器com.rsy下的所有子包-->
<!-- 只管理控制器, --><context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/><context:include-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice"/></context:component-scan>
</beans>
3.配置Heardcliqi
SpringMvc后端往往前端相关推荐
- 【两万字图文详解】 运动会管理系统-前后端分离-项目开发:【后端】SpringBoot, SpringMVC, MyBatis【前端】Vue.js,ElementUI
项目名称:运动会管理系统 技术栈: 后端:SpringBoot,SpringMVC,MyBatis,tkmapper,Maven聚合工程等 前端:Vue.js,Element-u ...
- vue学习笔记-01-前端的发展历史(从后端到前端,再到前后端分离,再到全栈)
vue学习笔记-01-前端的发展历史(从后端到前端,再到前后端分离,再到全栈) 这篇文章是博主在看vue-前端发展简史的时候做的笔记,以供后续学习复习 文章目录 vue学习笔记-01-前端的发展历 ...
- 小猿圈Python学习教程之后端接收前端回传的文件方法
现在人工智能已经深入到千家万户,随之而来的就是python技术的火爆,今天小猿圈python讲师为你讲解一下后端接收前端回传的文件方法,希望对于刚刚自学python的你有一定的帮助. 如下所示: fi ...
- 前端路由||路由的基本概念与原理||在开发中,路由分为: 后端路由 前端路由
前端路由 路由的基本概念与原理 vue-router的基本使用 vue-router嵌套路由 vue-router动态路由匹配 vue-router命名路由 vue-router编程式导航 基于vue ...
- 后端传前端中文显示都是问好_前后端分离,后台返回的数据前端没法写,怎么办?...
看到大家吊打后端,我来歪个楼. 首先,对于题主描述的 PHPer 吊打无疑,但并不是所有接口都可以随心所欲按照前端的要求来做,目前主要遇到几类接口: 1. 代理其他系统接口过来的(没法改底层,要转换需 ...
- jhipster 配置 mysql_java – 将jhipster后端和前端分成两个项目?
我正在尝试jhipster基于令牌的身份验证.它完美地运作. 现在,我想在不同的域上运行后端和前端代码.我怎样才能做到这一点? 这是我试过的: >运行yo jhipster并选择基于令牌的身份验 ...
- java 后端与前端Date类型与String类型互相转换(使用注解)
一:java 后端格式化输出Date类型的属性值到前端 后端返回的类型中,直接定义Date类型,加上此注解,直接将Date类型转成自定义的格式给前端 class TestDateOutput{@Jso ...
- RestAPI的进化之路,后端MVVM模式或许来临,通过观察者模式,后端收集前端的GET类请求,主动推送数据变更到前端
RestAPI的进化之路,后端MVVM模式或许来临,通过观察者模式,后端收集前端的GET类请求,主动推送数据变更到前端 最近几年,前端MVVM模式彻底变革了前端的开发模式,那这股火焰会烧到后端嘛? 我 ...
- springmvc处理器及前端控制器介绍
处理器 (1)非注解的处理器映射器和适配器 处理器映射器 第一种非注解的映射器 <bean class="org.springframework.web.servlet.handler ...
最新文章
- 26期20180716 iptables规则备份恢复 firewalld zone
- jquery and event
- [云炬python3玩转机器学习笔记] 1-3课程所使用的主要技术栈
- 电路常识性概念(2)-电容
- sim卡rfm_信用卡客户的RFM集群
- c++ enum 给定类型_C++11作用域内枚举enum
- [flask 优化] 由flask-bootstrap,flask-moment引起的访问速度慢的原因及解决办法
- python 保存图片代码_最简单的selenium+Python自动右键保存图片
- Swift App启动干了什么事情, 删掉UIApplicationMain,自定义实现main类, Main Runloop
- 2招PDF去密码,秒学秒懂秒用上!
- sfm三维重建源码_多视图几何三维重建实战系列之COLMAP
- 基于LASSO的波士顿房价分析
- 炫舞滑板机器人_教程丨自制鬼畜滑板机器人,用纸壳就能做
- 服务器心跳信号,服务器心跳线设置
- 利用halcon识别汽车检具孔面积和孔间距
- 一个系统测试的完整过程
- 电脑蓝屏错误代码大全及解决办法
- WiFi万能钥匙总裁:下一步重点是场景化大数据
- 什么是跨域?怎么实现跨域请求?
- OA厂商与OA用户:相处模式还能这样切换?