Introdution to Spring Mobile

Source: Internet
Author: User
Tags to domain

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]  &l T;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 "/>         &NBSP;&NBS P [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] &nbsP;<beans:bean class= "Org.springframework.mobile.device.site.SitePreferenceWebArgumentResolver"/>       [html] </argument-resolvers>   [html]  </annotation-driven>  

Introdution to Spring Mobile

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.