Announcement Announcement Module
Collapse
No announcement yet.
ResourceBundleViewResolver Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ResourceBundleViewResolver

    Hi there

    is there an online resource which describes in detail how to use ResourceBundleViewResolver (I admit I am slow on the uptake, and need a detailed explanation with examples)?

    Thanks,
    Peter

  • #2
    OK, it finally "clicked" with me. You define the "resolver" in the xxx-servlet.xml:

    <bean id="viewResolver" class="org.springframework.web.servlet.view.Resour ceBundleViewResolver">
    <property name="basename"><value>views</value></property>
    </bean>

    and then have a "views.properties" file, for example:

    bookView.class = org.springframework.web.servlet.view.JstlView
    bookView.url = WEB-INF/jsp/book/bookView.jsp

    bookEdit.class = org.springframework.web.servlet.view.JstlView
    bookEdit.url = WEB-INF/jsp/book/bookEdit.jsp


    But I would still be interested in more references to the use of ResourceBundleViewResolver.

    Thanks,
    Peter

    Comment


    • #3
      Originally posted by pak
      But I would still be interested in more references to the use of ResourceBundleViewResolver.
      The countries sample shipped with Spring uses locale specific view resolving with this resolver and is a good example of how to take advantage of its features.

      Regards,

      Comment


      • #4
        It's also possible to chain view resolvers, which I found to be a great solution when most of your pages go to JSTL JSPs, but when you have some exceptions to the rule.

        Code:
        <bean id="specialViewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
             <property name="order"><value>0</value></property>
             <property name="basename"><value>views</value></property>
        </bean>
        <bean id="typicalViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
             <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
                <property name="prefix"><value>/WEB-INF/jsp/</value></property>		
                <property name="suffix"><value>.jsp</value></property>
          </bean>

        Comment

        Working...
        X