gonzalad
Aug 29th, 2011, 08:27 AM
Hello,
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 :
@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/showthread.php?98933-InternalResourceViewResolver-and-mobile-views&highlight=mvc%3Aview-controller
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 :
@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/showthread.php?98933-InternalResourceViewResolver-and-mobile-views&highlight=mvc%3Aview-controller