2

I'm having trouble using Spring Mobile 1.1.2 and Spring MVC. The problem I'm having is, that in the application I have all views for desktop and for some desktop, I have mobile alternative.

I use LiteDeviceDelegatingViewResolver, which delegates to InternalResourceViewResolver. If both desktop and mobile views are present, everything works fine. On desktop I see desktop version, on mobile I see mobile version. The problem is when the mobile view is not present.

I know, that fallback resolution will only work when delegating to a view resolver which returns null from resolveViewName(String, Locale) if it cannot resolve a view. For example, InternalResourceViewResolver never returns null, so fallback resolution will not be available. So I didn't hope that will work.

But I tried to chain resolvers, with order 1 LiteDeviceDelegatingViewResolver(delegates to InternalResourceViewResolver) and with order 2 InternalResourceViewResolver (which point to desktop views all the time regardless on the device). My problem is, that it never gets to resolver number 2. Where is the problem?

Thanks

Josip Ivic
  • 3,639
  • 9
  • 39
  • 57
Roman Smetana
  • 19
  • 1
  • 2
  • 1
    Effectivly there is only a single `ViewResolver` only the `LiteDeviceDelegatingViewResolver` will be consulted. It will create a view name based on the returned view name and by the selected device (or preferences) and use that to retrieve a `View`. The delegating resolver is an `InternalResourceViewResolver` which always resolves to a view because it only constructs a URL. – M. Deinum Jul 18 '14 at 05:46

1 Answers1

0

According to Spring doc you just need to enable fullback resolution.

<property name="enableFallback" value="true" />

hope it helps you !

aimadbk
  • 41
  • 4