I have a web app and I want add the mobile version to it..
So I followed this guide to add spring-mobile, but I can't get my mobile views..
I don't want add in every controller's methods this piece of code:
if (device.isMobile()) {
return "mobile/myPage.jspx";
} else if (device.isTablet()) {
return "tablet/myPage.jspx";
} else {
return "myPage.jspx";
}
So I'm trying to set a view-resolver to get the right page. I use Tiles and this is its configuration:
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver" id="tilesViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
</bean>
And then I add this:
<bean class="org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver">
<constructor-arg>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
</constructor-arg>
<property name="tabletPrefix" value="tablet/" />
</bean>
But my we-app returns only /myPage.jspx
and never /mobile
or /tablet
pages.
How can I do?
Thank you!