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. @RequestMapping注解的使用,Controller方法返回值

    1,web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version=" ...

  2. RabbitMQ技术详解(转)

    RabbitMQ是什么 定义 RabbitMQ是一个开源的AMQP实现,服务器端用Erlang语言编写,支持多种客户端,如:Python.Ruby..NET.Java.JMS.C.PHP.Action ...

  3. 【iOS微博客户端开发】1、微博整体项目的构建

    回顾自己做过的项目,总结里面的知识点,分享自己参照WXHL的视频开发的一个模拟微博客户端的过程,为了还在IOS上找不到项目参考的朋友,这里会由一系列手把手的教程,如有不足,还希望可以抖抖小手,献上您宝 ...

  4. 利用LogParser分析IIS日志

    LogParser是微软官方出品的用于读取分析IIS日志的工具,使用类SQL语句过滤文本日志内容,并可将内容导出到csv.sqlserver作进一步分析    下载地址:http://www.micr ...

  5. Laravel 5系列教程六:表单 Forms

    免费视频教程地址https://laravist.com/series/laravel-5-basic 在开始之前,我们把界面先美化一点点先: 首先到https://github.com/JellyB ...

  6. phpunit与xdebug的使用

    基本说明: 1.xdebug是程序猿在调试程序过程中使用的bug调试暴露工具 windows下安装: 1)下载php对应的dll文件,下载地址:https://xdebug.org/download. ...

  7. 一次@value取值失败的原因

    网上down了一份源码.启动后报错,通过报错信息定位到这个地方: 之前对这个@Value的实现方式我也没了解过,所以乘机对springboot关于这一块的源码研究了一下.可以参考当时我的一篇分析记录& ...

  8. openerp所用QWEB2的调试笔记

    [1] 调式qweb模板时, 可以脱离openerp环境 阅读一下openerp目录 qweb目录中的几个html文件,可以作为起步 在浏览器下, 可以这样运行这些文件 http://127.0.0. ...

  9. MySql常用函数数学函数、加密函数等(转—收藏)

        MySql函数众多,这里只是列举了一部分常用的函数.   一.数学函数 ABS(x)                                         // 返回x的绝对值 BI ...

  10. Android Shape 详解

    1 http://blog.csdn.net/feng88724/article/details/6398193 2 <shape xmlns:android="http://sche ...