spring 配制与表单显示

1、spring.xml配制
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
        http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd  
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd ">

<!-- 配置sqlSessionFactory -->
<bean id="sqlSessionFactory_msp" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:mybatis_config/mybatis-config-msp.xml"></property>
<property name="dataSource" ref="dataSource_msp" />
</bean>

<bean id="sqlSessionTemplate_msp" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg ref="sqlSessionFactory_msp" />
</bean>

<!-- spring管理事务 -->
<bean id="txManager_msp"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource_msp" />
</bean>

<!-- Spring的声明式事务管理  -->
<!-- 设置与事务有关的各种属性  -->
<tx:advice id="txAdvice_msp" transaction-manager="txManager_msp">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
    <tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>

<!-- 声明切入点 -->
<aop:config>
<aop:pointcut id="interceptorPointCuts_msp"
expression="execution(* com.hcresearch.msp.*.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice_msp" pointcut-ref="interceptorPointCuts_msp" />
</aop:config>

<!-- 通过扫描的模式,自动注入bean -->
<bean id="mapperScannerConfigurer_msp" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage"
value="com.hcresearch.msp.*.mapper"></property>
<property name="sqlSessionTemplate" ref="sqlSessionTemplate_msp"></property>
<property name="sqlSessionFactory" ref="sqlSessionFactory_msp"></property>
</bean>
</beans>
2、表单显示

<form id="userForm"  name="userForm" target="_blank" action="quickReg" namespace="/" theme="simple">
<!--  <div class="wrong"><span class="tishi" id="errorInfo"></span><span><a style="cursor:hand "><img src="use_img/wrong.jpg" style="margin-top:5px;" onclick="window.parent.displayquickreg()" /></a></span></div>-->
<div class="wrong"><span class="tishi" id="errorInfo"></span><span style="float:right; margin-right:4px;"><a style="cursor:hand " onclick="displayquickreg_1()"><img src="use_img/wrong.jpg" style="margin-top:5px;" /></a></span></div>

<div class="textvalue">

  游戏账号 <input type="text" name="user.userName" id="userid" onblur="userValidate()"/>
   <br />游戏密码 <input type="password" name="user.pwd"  id="pwd1"onblur="pwdFirValidate()" />
     <br />确认密码 <input type="password" name="pwdsure" id="pwd2"  onblur="pwd2Validate()"/>
  <br />真实姓名 <input type="text" name="textfield" id="realNameId" onblur="validateRealName1()" name="user.realName"  />
  <br />身份证号 <input type="text" name="user.identifyNo" id="identifyNum"  onchange="identifyValidate1()" />
    <br />验证码<input type="text" name="str" style="width:55px; margin-right:5px;margin-left:20px; " /><img  src="rand.action" width="56px" height="24px" align="absmiddle" id="randImg" onclick="changeValidateCode(this)" alt="看不清楚?点击刷新"/>
<br />
<input style="background:none; border:none;color:#FFFFFF; width:10px;" type="checkbox" id ="chen" checked ="true" name="Checkbox1"  /><a href="http://passport.xkyx.com/usercenter/description/treaty.jsp" target="_blank">同意并接受服务协议和隐私声明</a>
<br />
<label>
               <div style="width:57px; height:26px; background:none; border:none; margin-left:50px;"><img  onclick="totalValidate1()" src="use_img/qd.jpg" alt="" /></div>
</label>

</div>

</form>

   <%@taglib prefix="s" uri="/struts-tags" %>
<div class="suc">
<div > <s:property value="message"/>  </div>

</div>
</div>

<jsp:include page="/template/foot.html" flush="true"/>

你可能感兴趣的:(spring)