webwork+spring+ibatis简单实例
webwork.properties
?
# extension for actions
webwork.action.extension=action
# spring integration
webwork.objectFactory=spring
webwork.objectFactory.spring.autoWire=type
?
web.xml
?
?<context-param>
??<param-name>contextConfigLocation</param-name>
??<param-value>/WEB-INF/applicationContext.xml</param-value>
?</context-param>
?<listener>
??<listener-class>
???org.springframework.web.context.ContextLoaderListener
??</listener-class>
?</listener>
?
?<servlet>
??<servlet-name>webwork</servlet-name>
??<servlet-class>
???com.opensymphony.webwork.dispatcher.ServletDispatcher
??</servlet-class>
?</servlet>
?<servlet-mapping>
??<servlet-name>webwork</servlet-name>
??<url-pattern>*.action</url-pattern>
?</servlet-mapping>
?
applicationContext.xml
?
?
?<bean id="myDataSource"
??/>
??<property name="dataSource" ref="myDataSource" />
?</bean>
?
?<bean id="baseDao" ref="sqlMapClient" />
?</bean>
?<bean id="accountInfoService" ref="baseDao"></property>
?</bean>
?
?<bean id="accountInfoAction" ref="accountInfoService"></property>
?</bean>
?
?
SqlMapConfig.xml
?
<sqlMapConfig>
?<settings cacheModelsEnabled="false" enhancementEnabled="true"
??lazyLoadingEnabled="false" errorTracingEnabled="true"
??useStatementNamespaces="true" />
??
?<typeHandler jdbcType="CLOB" javaType="java.lang.String"
??callback="org.springframework.orm.ibatis.support.ClobStringTypeHandler" />
??
?<sqlMap resource="sqlmap/adpm-listPage.xml" />
?
</sqlMapConfig>
?
?
adpm-listPage.xml
?
<sqlMap namespace="adpm-listPage">
?<select id="getAccountInfoFromADPM_CPA_INFO" resultparameterproperty="ID_NUM">
????T.ID_NUM=#ID_NUM#
???</isNotNull>
???<isNotNull prepend="AND" property="NAME">
????T.NAME=#NAME#
???</isNotNull>
??</dynamic>
?</select>
</sqlMap>