search

Home  >  Q&A  >  body text

java - springmvc How to implement different paths between PC and mobile terminals, using freemaker for view analysis

I want springmvc to implement different paths between PC and mobile. I use freemaker for view analysis.
I have no idea. Please give me some advice. Thank you!

PHP中文网PHP中文网2743 days ago746

reply all(3)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-17 10:11:06

    Use Spring Mobile to distinguish whether the client is PC or mobile.

    http://projects.spring.io/spr...

    @Controller
    public class HomeController {
    
        private static final Logger logger = 
                LoggerFactory.getLogger(HomeController.class);
    
        @RequestMapping("/")
        public void home(Device device) {
            if (device.isMobile()) {
                logger.info("Hello mobile user!");
            } else if (device.isTablet()) {
                logger.info("Hello tablet user!");
            } else {
                logger.info("Hello desktop user!");         
            }
        }
    
    }

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-17 10:11:06

    Brother Chacha is right! http://projects.spring.io/spr...

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-17 10:11:06

    You can make a reverse jump control on a shared link.

    reply
    0
  • Cancelreply