Posted By

jcblitz on 09/15/08


Tagged

JSP spring velocity


Versions (?)

Velocity and JSP views together in Spring configuration


 / Published in: XML
 

The first part goes in a myspring-servlet.xml context file. The second part is a properties file that is used to map the views with their locations. "projects" displays using a JSP and dashboard displays using a velocity template.

  1. <bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
  2. <property name="basename" value="views" />
  3. </bean>
  4.  
  5. <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
  6. <property name="resourceLoaderPath" value="/WEB-INF/velocity/" />
  7. </bean>
  8.  
  9. <!-- This actually goes in views.properties file below but I added it here for completeness -->
  10.  
  11. projects.class=org.springframework.web.servlet.view.JstlView
  12. projects.url=/WEB-INF/jsp/projects.jsp
  13.  
  14. dashboard.class=org.springframework.web.servlet.view.velocity.VelocityView
  15. dashboard.url=dashboard.vm

Report this snippet  

You need to login to post a comment.