Announcement Announcement Module
No announcement yet.
Default ViewController for mobile ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Default ViewController for mobile ?


    I'm using for the first time Spring Mobile, works great so far.

    Just one question though.

    In my webapp, I'm using :
    <mvc:view-controller path="/login"/>
    I want to decline the login page for mobiles, so I create login-mobile.jsp.

    Now, I want mvc:view-controller to display login.jsp for desktop application and login-mobile.jsp for mobile application.

    Only way to do that is to remove the mvc:view-controller and create a custom controller like this :
    public class LoginController {
        public String login(Device device) {
            if (device.isMobile()) {
                return "login-mobile";
            } else {
                return "login";
    Is there an easier way ?

    Otherwise should I create a JIRA issue to ask for adding something like :
    <mvc:mobile-view-controller path="/login"/> ?

    Thanks for the help !

    P.S. this thread is quite similar, but no JIRA found :

  • #2
    That is correct. Currently, this is how you would do it. We've had a lot of discussion around a "device aware" view resolver [0], and I think we have a good idea how that should look now. I'm planning on including an implementation in the next milestone release.