软件工程实践第二次小结

经过前三天的学习,我们实现了MySQL和myeclipse的链接以及配置成功,接下来的三天我们正式开始着手实践任务。我们要实现一个客户信息系统,包括增删改等操作。

然后点击客户信息管理,如图:

实现新增,点击新增,输入增加内容,点击删除后信息就会消失,如图;

数据库中也会出现张三这条信息:

这些就是实现后的结果,都是在myeclipse中操作的,主要会出错的地方就是代码对应,从前端到后端代码名称不一致会导致错误。所以我们在打代码的时候要注意。

配置代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!--数据库-配置数据连接池 -->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/dbssh">
</property>
<property name="username" value="root"></property>
<property name="password" value="123456"></property>
<property name="maxActive" value="100"></property>
<property name="maxWait" value="500"></property>
<property name="defaultAutoCommit" value="true"></property>
</bean>
<!--sessionFactory配置与管理 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/crm/bean/Customer.hbm.xml</value>
</list>
</property>
</bean>

<!--配置DAO -->
<bean id="customerDao" class="com.crm.dao.impl.CustomerDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!--配置service -->
<bean id="customerService" class="com.crm.bean.service.impl.CustomerServiceImpl">
<property name="customerDao" ref="customerDao"></property>
</bean>
<!--配置-新增saveAction -->
<bean id="saveCustomerAcion" class="com.crm.bean.acion.SaveCustomerAcion">
<property name="service" ref="customerService"></property>
</bean>
<!--配置-查询listAction -->
<bean id="listCustomerAcion" class="com.crm.bean.acion.ListCustomerAcion">
<property name="service" ref="customerService"></property>
</bean>
<!--配置-删除deleteAction -->
<bean id="removeCustomerAcion" class="com.crm.bean.acion.RemoveCustomerAcion">
<property name="service" ref="customerService"></property>
</bean>
<!--配置-typeAction -->
<bean id="typeAction" class="com.crm.bean.acion.TypeAction">
</bean>
</beans>

 

posted @ 2017-07-01 19:22  happines0  阅读(100)  评论(0编辑  收藏  举报