首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

webwork+spring+ibatis容易实例

2012-12-28 
webwork+spring+ibatis简单实例webwork.properties?# extension for actionswebwork.action.extensionact

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>

热点排行