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. Java高级架构师(一)第16节:Mybatis动态查询和Json自动拼装

    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...

  2. MythXinWCF通用宿主绿色版V1.2发布,及服务启动相关说明

      最新下载地址 更新日志: 1.宿主配置增加了最大连接及队列数.允许数据传输量 2.程序大量优化 3.bug修正 4.增加已服务方式启动 点击服务方式启动后,会将软件注册为服务. 然后软件就会变成一 ...

  3. zk删除node模式

    检查状态 状态描述指定的znode的元数据.它包含时间戳,版本号,ACL,数据长度和子znode等细项. 语法 stat /path 示例 stat /FirstZnode 输出 [zk: local ...

  4. TSynDBSQLDataSet

    TSynDBSQLDataSet 非内存表 TSynDBSQLDataSet = class(TSynBinaryDataSet) TSynBinaryDataSet = class(TSynVirt ...

  5. CSS:display:table

    使用display:table 垂直居中需要结合display:table-cell; 和vertical-align:middle; <!DOCTYPE html> <html l ...

  6. JVM Object Query Language (OQL) 查询语言

    Object Query Language (OQL) OQL is SQL-like query language to query Java heap. OQL allows to filter/ ...

  7. XPath注入技术综述

    一次完整的 XPath 注入攻击应该包括使用特殊构造的查询来提取一个 XML 数据库内的 数据或者信息.作为一门新的技术,XPath 注入在一定程度上和 SQL 注入漏洞有着惊人的相 似之处,通过下面 ...

  8. elasticsearch term 查询二:Range Query

    Range Query 将文档与具有一定范围内字词的字段进行匹配. Lucene查询的类型取决于字段类型,对于字符串字段,TermRangeQuery,对于数字/日期字段,查询是NumericRang ...

  9. [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket错误解决方法总结

    今天做一个特殊的业务处理,用JDBC连接SQLServer数据库载入驱动的时候,报例如以下错误: java.sql.SQLException: [Microsoft][SQLServer 2000 D ...

  10. PuTTY连接Linuxserver常常断线解决方式

    PuTTY在远程连接server之后.常常会断线提示"Software caused connection abort",并且常常在非常短的时间内就失去连接. 解决方式例如以下: ...