zoukankan      html  css  js  c++  java
  • Introdution to Spring Mobile

    1. In Eclipse, create a new Maven Project using the spring-mvc-jpa-archetype.

    2. Add the spring-mobile-device dependency to pom.xml.
    [html] view plaincopy
    <dependency>       
    <groupId>org.springframework.mobile</groupId>       
    <artifactId>spring-mobile-device</artifactId>      
    <version>1.0.0.RELEASE</version>   
    [html]  
    </dependency>  
    3. Add the following Spring Mobile interceptors in servlet-context.xml
    [html]  
    <interceptors>       
    [html]   
    <!-- Resolve the device that originated the web request -->      
    [html] view plaincopy
    <beans:bean class="org.springframework.mobile.device.DeviceResolverHandlerInterceptor" />       
    [html] 
    <!-- Manage the user's site preference -->       
    [html]  
    <beans:bean class="org.springframework.mobile.device.site.SitePreferenceHandlerInterceptor" />        
    [html]  
    <!-- Redirects mobile users to domain.com/quickspringmobile/spring/m/ -->       
    [html] 
    <beans:bean class="org.springframework.mobile.device.switcher.SiteSwitcherHandlerInterceptor" factory-method="urlPath">         <beans:constructor-arg value="/m" />           
    [html]  
    <beans:constructor-arg value="/quickspringmobile/spring" />       
    [html]  
    </beans:bean>   
    [html] 
    </interceptors>  
    4. The resolved device is available under the currentDevice request attribute. The site preference is available under the currentSitePreference request attribute.
    [html]  www.2cto.com
    <annotation-driven>      
    [html] 
    <argument-resolvers>           
    [html] 
    <beans:bean class="org.springframework.mobile.device.DeviceWebArgumentResolver" />          
    [html]  
    <beans:bean class="org.springframework.mobile.device.site.SitePreferenceWebArgumentResolver" />       
    [html] 
    </argument-resolvers>   
    [html]  
    </annotation-driven>  
  • 相关阅读:
    Spark的Shuffle机制
    Map Reduce的代码学习
    本地IDEA跑阿里云服务器Word Count
    HDFS的类学习和API基本操作
    本地IDEA(Windows)访问ECS服务器HBase
    本地IDEA访问ECS服务器HDFS
    阿里云ECS大数据环境搭建
    学会使用vue ui搭建项目
    用vue封装视频预览组件(手机端)
    项目中的部门使用级联选择器,编辑时初始化选中部门解决方案
  • 原文地址:https://www.cnblogs.com/atomgame/p/3986226.html
Copyright © 2011-2022 走看看