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

  • Default ViewController for mobile ?

    Hello,

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

    Just one question though.

    In my webapp, I'm using :
    Code:
    <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 :
    Code:
    @Controller
    public class LoginController {
    
    
        @RequestMapping("/login")
        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 : http://forum.springsource.org/showth...iew-controller

  • #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.

    [0] https://jira.springsource.org/browse/MOBILE-35

    Comment

    Working...
    X