java ssm框架_JavaWeb开发SSM框架搭建详解

1.需要用到的jar包:由于很多的jar包不好下载,我直接上传到百度网盘:

8eb27650242e973dccd18f892f22f2d4.png

7795bfdd885cab0986ecd918ad15ce85.png

很多,而且不好下载,我已经整理好好了:

关于SSM框架:以前的博客有介绍过

第一步:创建Dynamic Web Project

首先是整合之后的目录结构:

需要我们关注的只是我红线画出的:

85ce925254b851f910088bde792f69de.png

先把所有的jar包复制入lib文件夹:不同于传统java项目,这里会自动build path,总之复制进去就完事了

关于mybatis和spring的配置文件,分别在两个文件夹中:

2804c369b0a6052b16050b296c6111f6.png

首先来配置mybatis:SqlMapConfig.xml:

/p>

"http://mybatis.org/dtd/mybatis-3-config.dtd">

配置Spring:

Dao层:applicationContext-dao.xml

http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd

http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">

Service层:applicationContext-service.xml:

http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd

http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">

配置SpringMVC:springmvc.xml

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-4.0.xsd">

接下来就算最关键的一步:web.xml配置

SSM

index.html

index.htm

index.jsp

default.html

default.htm

default.jsp

contextConfigLocation

classpath:spring/applicationContext-*.xml

org.springframework.web.context.ContextLoaderListener

encoding

org.springframework.web.filter.CharacterEncodingFilter

encoding

UTF-8

encoding

/*

ssm

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:spring/springmvc.xml

1

ssm

/

其余的杂项配置:

1.数据库配置:用户名,数据库名,连接配置等等

jdbc.properties:

jdbc.driver=com.mysql.jdbc.Driver

jdbc.url=jdbc:mysql://localhost:3306/ssm?characterEncoding=utf-8

jdbc.username=root

jdbc.password=root

2.日志文件配置:

log4j.properties:

# Global logging configuration

log4j.rootLogger=DEBUG, stdout

# Console output...

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

3.至于resource.properties是后边项目需要的,和SSM框架无关

最后:Get方式乱码修改方式:

打开Tomcat的配置文件修改一个URIEncoding属性

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值