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

  • XmlViewResolver Issue

    Hello,

    I am trying to use XmlViewResolver like that :

    <bean id="viewResolver" class="org.springframework.web.servlet.view.XmlVie wResolver" />

    in myApp-servlet.xml.

    The views.xml file contains the following View definition :

    <bean id="homeView" class="myapp. VelocityLayoutView" parent="baseView">
    <property name="url" value="${templates.default.layout}"/>
    <property name="main" value="${templates.home.main}"/>
    <property name="header2" value="${templates.home.header2}"/>
    <property name="footer" value="${templates.default.closing}"/>
    </bean>

    When the viewResolver tries to create the bean “homeView” it fails because it can’t resolve the property names to the actual Velocity templates and
    therefore is looking for a template e.g. named ${templates.default.layout}.

    In myApp-servlet.xml I also define the following bean for property name resolution :

    <bean id="applicationResourcePropertyConfig" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>classpath:resource.properties</value>
    <value>classpath:myApp.properties</value>
    </list>
    </property>
    <property name="searchSystemEnvironment" value="true"/>
    </bean>


    Would anyone know why the above set up is not working?


    Thank you very much,


    Savakos

  • #2
    PropertyPlaceHolderConfigurer is a BeanPostProcessor that ONLY works on the ApplicationContext it is defined in. Your views.xml isn't part of the ApplicationContext, the XmlViewResolver creates its own.

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      PropertyPlaceHolderConfigurer is a BeanPostProcessor that ONLY works on the ApplicationContext it is defined in. Your views.xml isn't part of the ApplicationContext, the XmlViewResolver creates its own.

      Marten hi,

      Thank you very much for your reply.

      That was the problem indeed!


      cheers,


      savakos

      Comment

      Working...
      X