Hi,

I am currently developing multiple Spring-based web applications and in order that all the applications have the same look and feel I would like all my views.xml files (for each web app) to be able to reference the same base definitions. For example:

App 1 - views.xml

Code:
<bean name="app1View" parent="baseVelocityView">
<property name="attributesMap">
   <props>
      <prop key="contentFile">some-page.html</prop>
   </props>
</property>
</bean>
App 2 - views.xml

Code:
<bean name="app2View" parent="baseVelocityView">
<property name="attributesMap">
   <props>
      <prop key="contentFile">another.html</prop>
   </props>
</property>
</bean>
I have a jar which sits in shared/lib in Tomcat which contains useful classes, common configuration files and common templates. The main template does a velocity #include() of $contentFile defined in each view. That way all pages should be automatically wrapped up in the chosen look and feel. The problem is that I cannot get this mechanism to work, mainly because:


  • Using <import resource=""/> in each application's views.xml file does not allow classpath URLs to be used.


  • Defining them in a shared-spring.xml file in my common jar, loaded by the contextLoader of each web app also does not work since the XmlViewResolver creates its own namespace for each views.xml file - so the parent="" attributes do not work ('bean not found' errors)


Is there a way of defining common views in a common file within a shared/lib jar?

Thanks in advance for any help.
Matt