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!
曾经蜡笔没有小新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!");
}
}
}