php有ssm框架吗,SSM框架-企业门户网站-1-工程构建

刚入职一个星期,现在才有时间开始这个框架的博客,我自己接的项目,第一次拿商业项目开源,大神们可能看着会觉得这不怎么样吧,其实我上线的项目是PHP写的,我只是在这个项目的基础上,改为了SSM框架。首先构建一个Maven工程,然后配置好项目的文件夹和pom属性,其中文件夹设置流程如下:

新建的工程默认有src/main/java 、src/main/resources、src/test/java这三个文件夹,为了完整性我们加入一个test的资源文件夹:

AAffA0nNPuCLAAAAAElFTkSuQmCC

添加好这个资源文件夹后,还要设置好该文件夹输出的目录,对项目右键--->属性(Properties)

AAffA0nNPuCLAAAAAElFTkSuQmCC

然后打开新建的文件夹,粘贴目标路径

AAffA0nNPuCLAAAAAElFTkSuQmCC

接下来,我们新建好我们项目需要用的包,也就是配置好包名

AAffA0nNPuCLAAAAAElFTkSuQmCC

添加spring和mapper文件夹用于加入xml文件

AAffA0nNPuCLAAAAAElFTkSuQmCC

接下来我们配置一个个很重要的xml文件,这将让我们引入spring和mapper来管理整个工程首先是如何引入spring,我们配置一下在src/main/webapp/WEB-INF文件夹下的web.xml文件

AAffA0nNPuCLAAAAAElFTkSuQmCC

配置内容如下:

xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee

http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"

version="3.1" metadata-complete="true">

Archetype Created Web Application

index.jsp

Kaptcha

/Kaptcha

spring-dispatcher

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:spring/spring-*.xml

spring-dispatcher

/

其中spring-dispatcher这个标签,定义的意思就是扫描classpath下spring文件夹下的spring-XXX.xml 命名的所有文件

接下来我们配置spring下的所有spring-XXX.xml文件

AAffA0nNPuCLAAAAAElFTkSuQmCC

spring-dao.xml<?xml  version="1.0" encoding="UTF-8"?>

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/context

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

spring-service.xml<?xml  version="1.0" encoding="UTF-8"?>

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:context="http://www.springframework.org/schema/context"

xmlns:tx="http://www.springframework.org/schema/tx"

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/context

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

http://www.springframework.org/schema/tx

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

class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

spring-web.xml<?xml  version="1.0" encoding="UTF-8"?>

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

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

http://www.springframework.org/schema/mvc

http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

class="org.springframework.web.servlet.view.InternalResourceViewResolver">

class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

配置好这三个文件后,还差两个资源文件,因为spring-dao.xml里面有定义一个参数是classpath:jdbc.properties,定义的是一个文件,我们要在src/main/resources文件夹下定义一个文件jdbc.propertied ,还有一个文件是也是spring-dao.xml里定义的classpath:mybatis-config.xml ,定义mybatis属性jdbc.driver=com.mysql.jdbc.Driver

jdbc.url=jdbc:mysql://localhost:3306/database?userUnicode=true&characterEncoding=utf8

jdbc.username=root

jdbc.password=password

mybatis-config.xml<?xml  version="1.0" encoding="UTF-8"?>

configuration

PUBLIC "-//mybatis.org//DTD Config 3.0//EN"

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

到这里,我们配置好了SSM框架的基本内容,就好像画素描一样,我们先画好一个模子,明暗线条后面再添加,基本框架已经搭建好了,后面我们开始填充内容,自下而上的构建这个门户网站。毕业后的第一份正式工作,我自己也是很慌,做的实施,可能我技术确实不过关吧,不过我个人语言表达还是凑合的,做实施也算有优势。

下面一篇,我将讲解对应表来创建实体类。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值