解决方案 »
- 多主键表查询
- JAVA如何获取两个日期之间月份集合?!!
- (急)关于Struts1.2的action 跳转问题
- OGNL显示问题
- 搜索引擎框架选择
- jdbc+oracle乱码
- 实现一个计时功能
- ServletInputStream读的内容的感想与二进制的疑问
- 请大家帮助,NHibernate配置问题!!!!!!!!!必有答谢啊!!!!!
- jsp连接mysql的问题好像是jdbc driver的问题,求教!
- SQL语句在程序中得到的结果和在可视化的mysql工具查询的结果不同,为什么???
- 最近领导让我用hibernate+Spring整合做个模块,但是不是很熟悉,会,但是不是很精通..大家有什么速成的好书或者资料推荐么,只有五天时间。
http://download.csdn.net/detail/peng_hao1988/4191421
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
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/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- 用注解方式注入bean -->
<context:annotation-config/>
<context:component-scan base-package="com.template"/>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 事物配置 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- hibernate sessionFactory 创建 方法1 JDBC -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- 实体类扫描 -->
<property name="packagesToScan">
<list>
<value>com.template.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
</props>
</property>
</bean>
<!-- hibernate sessionFactory 创建 方法2 hibernate零配置 需要明显的GET&SET方法
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
</bean>--> <!-- 数据库连接池 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/ssh2_template" />
<property name="username" value="andymu" />
<property name="password" value="andymu" />
</bean>
<bean id="userAction" class="com.template.action.UserAction">
</bean> <!-- AOP代理 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true"/>
<tx:method name="add*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(public * com.template.service..*.*(..))" id="myPointcut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="myPointcut"/>
</aop:config>
</beans>
改成这样试试:
<s:form action="/login" method="post" validate="true">