kizz
2013-02-26 21:05
采纳率: 0%
浏览 254
已采纳

Spring+Struts+Ibatis的错误

包应该都是对的,我觉得应该是配置的原因,第一次使,求解答
错误是:上传附件的内容。靠您了,谢谢
[code="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">


[/code]
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

<!-- 通用属性文件定义 -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
             <value>WEB-INF/jdbc.properties</value>
        </list>
    </property>
</bean>
<!-- connect pool -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${jdbc.driverclass}"></property>
    <property name="url" value="${jdbc.url}"></property>
    <property name="username" value="${jdbc.username}"></property>
    <property name="password" value="${jdbc.password}"></property>
    <property name="maxActive" value="100"></property>
    <property name="maxIdle" value="30"></property>
    <property name="maxWait" value="200"></property>
    <property name="defaultAutoCommit" value="true"></property>
</bean>

<!-- IBatis part Spring提供的iBatis的SqlMap配置 -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation" value="WEB-INF/SqlMapConfig.xml"/>
    <property name="dataSource" ref="dataSource"/>
</bean>

<!-- DAO part -->
<bean id="userDao" class="com.ssi.dao.impl.UserDaoImpl">
    <property name="sqlMapClient" ref="sqlMapClient"></property>
</bean>

<!-- biz part -->
<bean id="userService" class="com.ssi.service.impl.UserServiceImpl">
    <property name="userDao" ref="userDao"></property>
</bean>

<!-- Action part -->
<bean id="loginUserAction" class="com.ssi.action.UserAction" scope="prototype">
    <property name="userService" ref="userService"></property>
</bean>

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="add*" propagation="REQUIRED" />
        <tx:method name="del*" propagation="REQUIRED" />
        <tx:method name="update*" propagation="REQUIRED" />
        <tx:method name="do*" propagation="REQUIRED" />
        <tx:method name="get*" propagation="REQUIRED" />
        <tx:method name="find*" propagation="REQUIRED" />
        <tx:method name="*" propagation="SUPPORTS" read-only="true" />
    </tx:attributes>
</tx:advice>
<aop:config>
    <aop:pointcut id="bizMethods" expression="execution(* com.ssi.service.*.*(..))" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods" />
</aop:config>


[/code]
这个是User.xml
[code="xml"]
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMap

PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-2.dtd">

<typeAlias alias="user" type="com.ssi.entity.User" />

<select id="CheckLogin" parameterClass="String" resultClass="user">
    <![CDATA[select password from ssiuser u where u.username = #username#]]>
</select>


[/code]

3条回答 默认 最新

相关推荐 更多相似问题