<action name="person"
class="com.tydic.ibatis.action.PersonAction">
<result name="list">/personList.jsp</result>
<result name="add">/personEdit.jsp</result>
</action>
</package>
</struts>
2、Sqlmapconfigexample.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map
Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings useStatementNamespaces="true"/>
<sqlMap resource="com/tydic/ibatis/entity/Person.xml"/>
</sqlMapConfig>
3、applicationContext.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean
class="org.springframework.beans.factory.annotation.AutowiredAnnotati
onBeanPostProcessor" />
<bean id="myDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://127.0.0.1:3306/ibatisDB">
</property>
<property name="username" value="root"></property>
<property name="password" value="123456"></property>
</bean>
<!-- 配置 iBatis 的 sqlMapClient,这里当然是交给了 spring 去处理,其中,将
SqlMapConfig 文件放到了 WEB-INF 的 iBatis 目录下,也是便于管理 -->
<bean id="myIbatis"
评论0
最新资源