maven项目创6 表现层整合
springmvc.xm创建l 和 web.xml配置 ,报错先不管
springmvc.xml
com.taotao.controller 空包
其中 资源映射 是等 web.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:p="http://www.springframework.org/schema/p"
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/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.taotao.controller" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<!-- 资源映射 -->
<mvc:resources location="/WEB-INF/css/" mapping="/css/**"/>
<mvc:resources location="/WEB-INF/js/" mapping="/js/**"/> <!-- 定义文件上传解析器 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 设定默认编码 -->
<property name="defaultEncoding" value="UTF-8"></property>
<!-- 设定文件上传的最大值5MB,5*1024*1024 -->
<property name="maxUploadSize" value="5242880"></property>
</bean>
</beans>
web.xml 配置

<!-- 加载spring容器 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/applicationContext-*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 解决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>
<!-- springmvc的前端控制器 -->
<servlet>
<servlet-name>taotao-manager</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- contextConfigLocation不是必须的, 如果不配置contextConfigLocation, springmvc的配置文件默认在:WEB-INF/servlet的name+"-servlet.xml" -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/springmvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>taotao-manager</servlet-name>
<!-- 拦截所有请求 -->
<url-pattern>/</url-pattern>
</servlet-mapping>

会拦截所有请求包括静态资源,需要在springmvc.xml中添加静态资源映射

maven项目创6 表现层整合的更多相关文章
- maven项目创建4 dao层整合
项目配置文件要放在打包成war包的web项目中 创建文件步骤 1 SqlMapConfig.xml <?xml version="1.0" encoding=" ...
- maven项目创建5 service层整合
创建service相关文件 创建applicationContext-service.xml文件 <?xml version="1.0" encoding="UTF ...
- (转)淘淘商城系列——SSM框架整合之表现层整合
http://blog.csdn.net/yerenyuan_pku/article/details/72721120 上文我们一起学习了Service层的整合,本文将教大家如何整合表现层. 我们在t ...
- maven项目创7 配置分页插件
页面编写顺序 首先确定是否拥有想要的pojo(对象实体类)———>dao层mybatis配置——>service层的接口及实现类——>controller(web下) 分页插件作 ...
- maven项目快速搭建SSM框架(一)创建maven项目,SSM框架整合,Spring+Springmvc+Mybatis
首先了解服务器开发的三层架构,分配相应的任务,这样就能明确目标,根据相应的需求去编写相应的操作. 服务器开发,大致分为三层,分别是: 表现层 业务层 持久层 我们用到的框架分别是Spring+Spri ...
- ssm框架整合+maven项目创建
在引入外部maven插件后就可以创建一个maven项目了,这篇文章主要介绍ssm框架的整合和如何创建一个maven项目 1.在开发工具的项目空白区单击右键,依次选择New.Other,会出现如下界面, ...
- eclipse 创建maven 项目 动态web工程完整示例 maven 整合springmvc整合mybatis
接上一篇: eclipse 创建maven 项目 动态web工程完整示例 eclipse maven工程自动添加依赖设置 maven工程可以在线搜索依赖的jar包,还是非常方便的 但是有的时候可能还需 ...
- Maven项目中Spring整合Mybatis
Maven项目中Spring整合Mybatis 添加jar包依赖 spring需要的jar包依赖 <dependency> <groupId>org.springframewo ...
- maven项目ssh框架的整合
1.环境 eclipse版本:Eclipse Mars2 4.5jdk版本:1.8maven版本:apache-maven 3.3.9zhnegs这是主要的开发工具版本,ssh的各种jar包版本就不列 ...
随机推荐
- IE浏览器(js)new Date()带参返回NaN解决方法
function myNewDate(str) { if(!str){ return 0; } arr=str.split(" "); d=arr[0].split("- ...
- Eclipse 新建.jsp页面后,页面头部标签报错的解决方法
Eclipse 新建.jsp页面后,页面头部标签报错的解决方法 1.报错地方: 2.解决方法: .jsp页面右键==>BUild Path ==>Configure Build Path. ...
- 预约系统(二) MVC框架搭建
采用VS2013,自带的MVC4来搭建 MODEL层,表对象的建立: T_Bm.cs using System; using System.Collections.Generic; using Sys ...
- Spring的基本应用(1):依赖以及控制反转
在说到这里的时候,首先要说下程序的耦合和解耦,以便对上节做一个解释. 一.程序的耦合和解耦 1.程序的耦合性(Copling) (1)程序的耦合性,也叫做耦合度,是对模块之间关联程度的度量,耦合性的强 ...
- pycharm terminal打开在虚拟环境
pycharm调试是虚拟环境,terminal不是虚拟环境,搞了好久,原来需要激活一下 cd venv\Scripts> 去虚拟环境的Script目录下,运行activate.bat激活环境 ...
- Vue路由守卫之路由独享守卫
路由独立守卫,顾名思义就是这个路由自己的守卫任务,就如同咱们LOL,我们守卫的就是独立一条路,保证我们这条路不要被敌人攻克(当然我们也得打团配合) 在官方定义是这样说的:你可以在路由配置上直接定义 ...
- psutil:系统、进程,信息都在我的掌握之中
获取cpu的逻辑数量 import psutil print(psutil.cpu_count()) # 12 获取CPU的物理核心数 import psutil print(psutil.cpu_c ...
- RaspberryPi交叉编译环境配置-Ubuntu & wiringPi & Qt
1.配置RaspberryPi交叉编译环境: 在开发RaspberryPi Zero的过程中,由于Zero板卡的CPU的处理性能比较弱,因此其编译的性能比较弱,需要将代码在PC电脑上交叉编译完成之后再 ...
- Qt Creator 4.10 Beta版发布
使用Qt Creator 4.10 Beta,现在支持固定文件,因此即使在关闭所有文件时它们仍然保持打开状态,围绕语言服务器协议支持继续集成,将Android目标添加到CMake/Qbs项目,支持Bo ...
- QT 给工程添加图片
先打开如图的打开方式 然后我们看到以下的画面,选择下面的 然后我们选择如下:,这里我们要注意我们的图片资源有一定要和QRC资源在同一个文件夹中 之后我们通过在stylesheet里面设置来使用我们添加 ...