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>  

Introdution to Spring Mobile的更多相关文章

  1. Spring Mobile 1.1.0.RC1 和 1.0.2 发布

    Spring Mobile 1.1.0.RC1 发布了,该版本包含: 支持 Firefox OS 设备的检测 修复了使用 LiteDeviceDelegatingViewResolver 处理重定向和 ...

  2. Spring Mobile是如何判断访问设备的类型的

    Spring最近换域名了,去转转,发现了一个有意思的项目:spring mobile. http://projects.spring.io/spring-mobile/ 这个项目有很多实用的功能,如识 ...

  3. Spring Mobile——探测客户端设备和系统

    Spring Mobile--探测客户端设备和系统 今天闲来无事,浏览Spring的官方网站,发现了Spring Mobile项目,之前也看到过,还以为是针对手机端的项目,并没有细看.今天仔细看了一下 ...

  4. 160606、springmvc中使用Spring Mobile

    springmobile特点: 1.客户端设备识别:识别结果只有3种类型:NORMAL(非手机设备).MOBILE(手机设备).TABLET(平板电脑). 2.网站偏好设置:Spring 通过设备识别 ...

  5. 第一个Spring Boot Web程序

    需要的环境和工具: 1.Eclipse2.Java环境(JDK 1.7或以上版本)3.Maven 3.0+(Eclipse已经内置了) 写个Hello Spring: 1.新建一个Maven项目,项目 ...

  6. Spring boot配置文件 application.properties

    http://www.tuicool.com/articles/veUjQba 本文记录Spring Boot application.propertis配置文件的相关通用属性 # ========= ...

  7. Spring学习笔记—Spring之旅

    1.Spring简介     Spring是一个开源框架,最早由Rod Johnson创建,并在<Expert One-on-One:J2EE Design and Development> ...

  8. 玩转spring boot——properties配置

    前言 在以往的java开发中,程序员最怕大量的配置,是因为配置一多就不好统一管理,经常出现找不到配置的情况.而项目中,从开发测试环境到生产环境,往往需要切换不同的配置,如测试数据库连接换成生产数据库连 ...

  9. 一句话概括下spring框架及spring cloud框架主要组件

    作为java的屌丝,基本上跟上spring屌丝的步伐,也就跟上了主流技术.spring 顶级项目:Spring IO platform:用于系统部署,是可集成的,构建现代化应用的版本平台,具体来说当你 ...

随机推荐

  1. 5.4 集合的排序(Java学习笔记)(Collections.sort(),及Arrays.sort()底层分析)

    1.Comparable接口 这个接口顾名思义就是用于排序的,如果要对某些对象进行排序,那么该对象所在的类必须实现 Comparabld接口.Comparable接口只有一个方法CompareTo() ...

  2. Bootstrap-table实现动态合并相同行(表格同名合并)

    写在前面: 有时候表格的需求就是奇奇怪怪的,最近要做的表格需要实现当紧挨着的记录的某一列的行元素内容相同,就将其合并.要是不是相同的就不合并.如果表格数据的顺序不需要被改变,这个样子是可以很简单就完成 ...

  3. java static代码段

    1)java中还有个static代码块的形式,形式为 static {……}.static代码块是类定义的一部分,仅仅在类被初次加载的时候被调用一次,之后再调用不会再加载.那么类什么时候首次被加载呢? ...

  4. Java高级架构师(一)第07节:远程使用以及冲突解决

  5. iOS使用CoreData实现收藏功能

    一般做收藏都是使用数据库或者归档,使用CoreData实现收藏功能就是没事时练一下,实现大概和数据库差不多. 首先创建一个工具类继承NSObject,在里面实现所需要的方法. 工具类的.h文件: ty ...

  6. 【java】File的使用:将字符串写出到本地文件,大小0kb的原因

    实现方法: 暂时写一种方法,将字符串写出到本地文件,以后可以补充更多种方法: public static void main(String[] args) { /** * ============== ...

  7. DBA_SEGMENTS - 查看数据库对象所分配的物理存储空间

    SELECT SEGMENT_NAME,SEGMENT_TYPE,<code>TABLESPACE_NAME</code>,EXTENTS,BLOCKS,BYTES/1024/ ...

  8. postgres访问认证配置文件pg_hba.conf

    pg_hba.conf(默认位于/var/lib/pgsql/10/data/pg_hba.conf)是设置访问认证的主要文件,格式为每条记录一行,每行指定一条访问认证. 设定一条访问认证包含了5个部 ...

  9. go/golang init()方法的调用

    go/golang main() init()方法的调用 u011156212 · 2015-10-20 13:00:05 · 9965 次点击 · 预计阅读时间 1 分钟 · 27分钟之前 开始浏览 ...

  10. crontab 写入文件目录

    一.crontab 目录 [root@next-cloud-server etc]# cd /var/spool/cron/ [root@next-cloud-server cron]# ls roo ...