SSM个人思路总结

SSM个人思路总结

1、整体技术点

后端框架SSM:SpringMVC+Spring+MyBatis
前端框架:BootStrap
分页-PageHelper

2、环境搭建

2.1创建maven工程

通过idea工具,使用骨架的webapp方式创建或者跳过骨架进行创建;其中可能会缺少web.xml文件;下面是xml中一部分:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://xmlns.jcp.org/xml/ns/javaee"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
	id="WebApp_ID" version="3.1">
</web-app>

2.2、引入依赖的jar包

可以自行去maven官网上去下载以下相关的jar包

Spring相关
SpringMVC相关
MyBatis相关
数据库连接池
数据库驱动
JSTL
servlet-api
Junit 单元测试
Log4j 日志记录
Hibernate Validate 数据校验
Jackson @ResponseBody返回JSON数据
文件上传等

2.3、引用前端内容

css 文件、fonts 文件、js 文件、jQuery 文件

(可以去BootStrap官网上去找,自己练习就随便写个页面)

2.4、添加web文件

思路:项目最先加载的配置文件,所以里面先要加载Spring容器、再添加字符编码过滤器、Rest风格的URI、配置前端控制器

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://xmlns.jcp.org/xml/ns/javaee"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
	id="WebApp_ID" version="3.1">
	
	<!-- 加载Spring容器 -->
	<!-- needed for ContextLoaderListener -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext.xml</param-value>
	</context-param>
	
	<!-- 字符编码过滤器,放在所有过滤器最前面 -->
	<filter>
		<filter-name>encodingFilter</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>
		<init-param>
			<param-name>forceRequestEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
		<init-param>
			<param-name>forceResponseEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
<!-- 		<init-param>
			<param-name>forceEncoding</param-name>
			<param-value>true</param-value>
		</init-param> -->
	</filter>
	<filter-mapping>
		<filter-name>encodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	
	<!-- 使用Rest风格的URI,将页面普通的POST请求转为指定的delete和put请求 -->
	<filter>
		<filter-name>HiddenHttpMethodFilter</filter-name>
		<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>HiddenHttpMethodFilter</filter-name>
		
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值