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 如何构建全国统一的物流管理平台?
  • ¥100 ijkplayer使用AndroidStudio/CMake编译,如何支持 rtsp 直播流?
  • ¥20 和学习数据的传参方式,选择正确的传参方式有关
  • ¥15 这是网络安全里面的poem code
  • ¥15 用js遍历数据并对非空元素添加css样式
  • ¥15 使用autodl云训练,希望有直接运行的代码(关键词-数据集)
  • ¥50 python写segy数据出错
  • ¥20 关于线性结构的问题:希望能从头到尾完整地帮我改一下,困扰我很久了
  • ¥30 3D多模态医疗数据集-视觉问答
  • ¥20 设计一个二极管稳压值检测电路