Springmvc+mybatis how to pass value to XML "Go"

Source: Internet
Author: User

Directly on the code    first from the entry of the program says:  web.xml <?xml version= "1.0"  encoding= "UTF-8"?>< web-app version= "2.4"  xmlns= " xmlns:xsi=" " xsi:schemalocation="  /web-app_2_4.xsd " >  <welcome-file-list>    <welcome-file>index.jsp</ welcome-file>  </welcome-file-list>    <!--   Set the time that the session expires   -->  <session-config>  <session-timeout>20</ session-timeout>  </session-config>    <!--   Read the spring configuration file   --> <context-param>  <param-name>contextconfiglocation</ Param-name>  <param-value>classpath:config/spring.xml;classpath:config/spring-mybatis.xml </param-value>  </context-param>    <listener>  < Listener-class>org.springframework.web.context.contextloaderlistener</listener-class>  </listener>     < Listener>    <listener-class> Org.springframework.web.util.introspectorcleanuplistener</listener-class>  </listener>   <!--   Set character encoding to set all character encoding consent to utf-8  -->  <filter>   <filter-name>filterEncoding</filter-name>  <filter-class> Org.springframework.web.filter.characterencodingfilter</filter-class>  <init-param>   <param-name>encoding</param-name>  <param-value>utf-8</param-value >  </init-param>  </filter>    <filter-mapping>   <filter-name>filterencoding</filter-name>  <url-pattern>/</ url-pattern>  </filter-mapping>    <!--   generate a servlet for one-time verification code  -->  <servlet>  <servlet-name>verifyCode</servlet-name>   <servlet-class>com.longhang.tool.verifyCode.VerifyCodeServlet</servlet-class>   </servlet>    <!--   hand over all *.do requests to SPRINGMVC's dispatcherservlet for processing   -->  <servlet>  <servlet-name>dispatcherservlet</ servlet-name>  <servlet-class>org.springframework.web.servlet.dispatcherservlet</ servlet-class>  <init-param>  <param-name>contextconfiglocation</ param-name>  <param-value>classpath:config/springmvc-config.xml</param-value>   </init-param>  <load-on-startup>1</load-on-startup>  </servlet >    <servlet-mapping>  <servlet-name>verifycode</servlet-name >  <url-pattern>/verifycode</url-pattern>  </servlet-mapping>    <servlet-mapping>   <servlet-name>dispatcherservlet</servlet-name>  <url-pattern>*.do</ URL-PATTERN&GT;&NBSP;&NBSP;&LT;/SERVLET-MAPPING&GT;&LT;/WEB-APP&GT;SPRINGMVC configuration file <?xml version= "1.0"  encoding= "UTF-8"? >   <beans xmlns= ""      xmlns:xsi= ""  xmlns:p= ""      xmlns:context= ""      xsi:schemalocation = " /spring-beans-3.0.xsd    /spring-aop-3.0.xsd    / Spring-tx-3.0.xsd    /spring-context-3.0.xsd ">    <!--    Configure the automatically scanned package so that it scans all packages under     com.longhang,controller  -->     <context:component-scan base-package =  "Com.longhang.controller" ></context: component-scan>   <!--     Configure View Resolver    resolve view logical name to/*.jsp -->  <bean class =  " Org.springframework.web.servlet.view.InternalResourceViewResolver ">  <property name  =  "prefix"  value =  "/" ></property>  <property name =  "Suffix"  value =  ". JSP" ></property>  </bean>  </beans> Spring.xml Configuration <?xml version= "1.0"  encoding= "UTF-8"? ><beans xmlns= ""  xmlns:xsi= ""  xmlns:context= ""  xsi:schemalocation= "/spring-beans-3.0.xsd/spring-context-3.0.xsd" ><context: property-placeholder location= "Classpath:config/druid.properties"  /><!--  Automatic scanning (auto-injection)   --><context:component-scan base-package =  "Com.longhang.service" ></context: Component-scan></beans>spring-mybatis.xml Configuration <?xml version= "1.0"  encoding= "UTF-8"?>< Beans xmlns= "" &nbSp;xmlns:xsi= " xmlns:tx=" " xmlns:aop=" " xsi:schemalocation="  /spring-beans-3.0.xsd   /spring-tx-3.0.xsd /spring-aop-3.0.xsd ">    <!--  Configure data sources  --> <!--    <bean name =  "datasource"  class =  " Com.alibaba.druid.pool.DruidDataSource " init-method = " Init " destroy-method = " Close ">    <property name =" url " value = " ${jdbc_url} "> </property>    <property name= "username"  value= "${jdbc_userName}"   /> <property name= "Password"  value= "${jdbc_password}"  />     </bean>         --><bean name =  " DataSource " class = " Com.alibaba.druid.pool.DruidDataSource " init-method = " Init " destroy-method =&nbsP; " Close ">    <property name =" url " value = " jdbc:mysql:// Localhost:8000/bookshopping "></property>    <property name=" username "  value= "root"  /> <property name= "password"  value= "13072399672"  />      </bean>        <!-- Configure sqlsessionfactory  and read some configuration of MyBatis-->    <bean name =  " Sqlsessionfactory " class = " Org.mybatis.spring.SqlSessionFactoryBean ">     <property name =  "DataSource"  ref =  "DataSource" ></property>     <property name= "Mapperlocations"  value= "Classpath:mapper/*.xml"/>     </bean>        <!--      Auto-scan   Inject mapper interface generation agent into SPRING&NBSP;&NBSP;&NBsp; -->    <bean class= "Org.mybatis.spring.mapper.MapperScannerConfigurer "><property name=" Basepackage " value=" Com.longhang.dao " /><property name=" Sqlsessionfactorybeanname " value=" Sqlsessionfactory " /></bean>         <!--     Configure things     -->    <bean id =  "TransactionManager"  class =  " Org.springframework.jdbc.datasource.DataSourceTransactionManager ">    <property  name =  "DataSource"  ref =  "DataSource" ></property>     </bean>        <!--&NBSP;&NBSP;&NBSP;&NBSP;&LT;TX: annotation-driven transaction-manager =  "TransactionManager"/>    -->      <!--     The specific content of the things &NBsp;  --><tx:advice id= "Transactionadvice"  transaction-manager= "TransactionManager" ><tx:attributes><tx:method name= "add*"  propagation= "REQUIRED"  /><tx:method  name= "append*"  propagation= "REQUIRED"  /><tx:method name= "insert*"  propagation= "REQUIRED"  /><tx:method name= "save*"  propagation= "REQUIRED"  /><tx:method  Name= "update*"  propagation= "REQUIRED"  /><tx:method name= "modify*"  propagation= " REQUIRED " /><tx:method name=" edit* " propagation=" REQUIRED " /><tx:method  Name= "delete*"  propagation= "REQUIRED"  /><tx:method name= "remove*"  propagation= " REQUIRED " /><tx:method name=" Repair " propagation=" REQUIRED " /><tx:method  Name= "Delandrepair"  propagation= "REQUIRED"  /><tx:method name= "get*"  propagation= " SUPPORTS " /><tx:mEthod name= "find*"  propagation= "SUPPORTS"  /><tx:method name= "load*"  propagation = "SUPPORTS"  /><tx:method name= "search*"  propagation= "SUPPORTS"  /><tx:method  name= "datagrid*"  propagation= "SUPPORTS"  /><tx:method name= "*"  propagation= " SUPPORTS " /></tx:attributes></tx:advice><!--     define a slice to add things to the defined facets    -->    <aop:config><aop:pointcut id= " Transactionpointcut " expression=" Execution (* com.longhang.service.. *impl.* (..)) "  /><aop:advisor pointcut-ref= "Transactionpointcut"  advice-ref= "TransactionAdvice"  / ></aop:config></beans> about MyBatis Mapping file <?xml version= "1.0"  encoding= "UTF-8" &NBSP;? ><! doctype mapper public  "-//mybatis.org//dtd mapper 3.0//en"   ""  >< Mapper namespace= "Com.longhang.dao.userDao.UserDao" >  <resultMap id = " Baseresultmap " type = " Com.longhang.entity.user.User ">  <id column = " UID " property = " UID " jdbcType = " CHAR "/>  <result column = " LoginName "  property =  "LoginName"  jdbcType =  "VARCHAR"/>  <result column  =  "Loginpass"  property =  "Loginpass"  jdbcType =  "VARCHAR"/>   <result column =  "Email"  property =  "email"  jdbcType =  " VARCHAR "/>  <result column = " status  property =  "status"   jdbctype =  "VARCHAR"/>  <result column =  "Activationcode"   property =  "Activationcode"  jdbcType =  "CHAR"/>  </resultmap>< sql id =  "Base_column_lisT ">  uid,loginname,loginpass,email,status,activationCode  </sql>    <!--by ID query     return type is user  -->  <select id= "FindByID"  resultmap= "Baseresultmap"  parametertype= "java.lang.String"  >    select      <include refid= "Base_column_list"  />    from  l_user    where uid = #{uid,jdbcType=CHAR}  </select>     <!--   Query by Activationcode    return value is user  -->     <select id =  "Findbyactivationcode"  resultMap =  " Baseresultmap " parameterType = " java.lang.String ">  select <include  refid =  "Base_column_list"/>  from l_user  where activationcode  = #{activationcode}  </select>  <!-- 

Framework/Platform composition:

MAVEN+SPRINGMVC + Mybatis + Shiro (permissions) + Tiles (template) +activemq (Message Queuing) + Rest (service) + WebService (service) + EHcache (cache) + Quartz (timed schedule) + HTML5 (supports PC, IOS, Android)

user rights system:
Organizational structure: Roles, users, user groups, organizations, permission points: Pages, methods, buttons, data permissions, Hierarchical authorization

New project management experience :
Rapid Prototyping, component tree, version control, module porting, collaborative development, Real-time monitoring, Release Management

Sustainable integration:
All components are portable, customizable, extensible, and build on development results , forming a virtuous circle of sustainable development

platform platform:  
Windows XP, Windows 7, Windows 10, Linux, Unix

server container:
Tomcat 5/6/7, Jetty, JBoss, WebSphere 8.5 

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" Http://img1.ph.126.net/ih_ Wv-nbb2hd9smjjq1t3g==/6631750562422479745.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px;float:none; >

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img2.ph.126.net/ Oy6hnrtrph3vl9ozclvezq==/6632155182698397854.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img0.ph.126.net/ Fbrorxuujqmmjisn1ojsag==/6631704382934106645.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img0.ph.126.net/ Ksb5u7fywailwlhomy5-pa==/6631672497096906354.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img0.ph.126.net/ Jelavp_pxvgchumrn-cjza==/6631931981837957487.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img2.ph.126.net/ Kwhzn5felbs9jnz6eknl0g==/6631769254120146008.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img0.ph.126.net/ 0naq3wg_mait95j7z83xrq==/6631563645445749636.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img2.ph.126.net/ Cwbubbnuxlsap-iv_39_yg==/6631930882326329738.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img1.ph.126.net/ F2plihnzsuttda6ip5k_kq==/6631503172306234441.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img0.ph.126.net/ Rbjcl-wbhfyze16wz3kr3a==/6631708780980629382.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>

650) this.width=650; "alt=" build distributed services based on Dubbo Framework (II)-Zookeeperkafka-zookeeperkafka's Blog "src=" http://img0.ph.126.net/ 9qkbute3a2ji7xdk2vylka==/6631656004422492075.png "style=" border:0px;height:auto;margin:0px 10px 0px 0px; "/>


Springmvc+mybatis how to pass value to XML "Go"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.