java - springmvc How to implement different paths between PC and mobile terminals, using freemaker for view analysis
PHP中文网
PHP中文网 2017-05-17 10:09:06
0
3
752

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中文网

认证0级讲师

reply all(3)
曾经蜡笔没有小新

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!");         
        }
    }

}
曾经蜡笔没有小新

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

phpcn_u1582

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template