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条回答 默认 最新

  • book_humanlixin 2013-02-27 09:42
    关注

    ''中的parameterClass和resultClass这两个属性是iBatis提供的吗?我没有用过,所以看上去这两个属性有疑问。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝