RSS
热门关键字:  java  Ajax  JSP  JSF  Struts
当前位置 : 首页>Spring>列表

用JSF+Spring+IBatis搭建一个简单框架

来源: 作者: 时间:2007-08-18 点击:

web.xml:关键是插入Spring的监听

 

<listener> 
        <listener-class> 
            org.apache.myfaces.webapp.StartupServletContextListener 
        </listener-class> 
    </listener> 
    <listener> 
        <listener-class> 
            org.springframework.web.context.ContextLoaderListener 
        </listener-class> 
    </listener>

Spring配置文件applicationContext.xml:这里是把IBatis的数据源写在Spring的文件中,使Spring和IBatis结合起来

 

<!-- dateSource --> 
    <bean id="dataSource" 
        class="org.apache.commons.dbcp.BasicDataSource" 
        destroy-method="close"> 
        <property name="driverClassName"> 
            <value>com.mysql.jdbc.Driver</value> 
        </property> 
        <property name="url"> 
            <value>jdbc:mysql://192.168.102.19/bookadmin</value> 
        </property> 
        <property name="username"> 
            <value>bookadmin</value> 
        </property> 
        <property name="password"> 
            <value>123456</value> 
        </property> 
    </bean> 


    <!-- sqlMapClient --> 
    <bean id="sqlMapClient" 
        class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> 
        <property name="configLocation"> 
  <value> 
                classpath:thiz/ks/bookadmin/dao/ibatis/SqlMapConfig.xml 
            </value> 
        </property> 
    </bean>

IBatis的SqlMap文件SqlMapConfig.xml和JSF的配置文件faces-config.xml:该怎么写还是怎么写。

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
Google Adsense
相关文章