title: Velocity + Struts2 + Sitemesh + Spring +Hibernate Integration How to configur web.xml?
body: <p>I needed to create an application using Struts2 as MVC,Hibernate for data access and spring in the business logic. 
  And also I needed to use Velocity for presentaion and sitemesh for templating. </p>
  
  <p>Integrating Hibernate and Spring is done easily but integrating spring, sitemesh and velocity together with Struts2 
  is not clear for me but I can use velocity,spring and sitemsh individually with Struts2. </p>
  
  <p>Of course as illustrated in this example <a href="http://www.rkcole.com/articles/struts/crudTutorial/step4.html" rel="nofollow noreferrer">http://www.rkcole.com/articles/struts/crudTutorial/step4.html</a> 
  sitemesh and spring can be integrated with struts2 configuring web.xml as </p>
  
  <pre><code>&lt;listener&gt; 
  &lt;listener-class&gt; 
  org.springframework.web.context.ContextLoaderListener 
  &lt;/listener-class&gt; 
  &lt;/listener&gt; 
  
  &lt;filter&gt; 
  &lt;filter-name&gt;sitemesh&lt;/filter-name&gt; 
  &lt;filter-class&gt;com.opensymphony.module.sitemesh.filter.PageFilter&lt;/filter-class&gt; 
  &lt;/filter&gt; 
  
  
  &lt;filter-mapping&gt; 
  &lt;filter-name&gt;sitemesh&lt;/filter-name&gt; 
  &lt;url-pattern&gt;/*&lt;/url-pattern&gt; 
  &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt; 
  &lt;/filter-mapping&gt; 
  </code></pre>
  
  <p>Now my task is to integrate velocity with this combination............... </p>
  
  <p>Normally to integrate Velocity and struts2 I use the following </p>
  
  <pre><code>&lt;servlet-class&gt; 
  org.apache.velocity.tools.view.servlet.VelocityViewServlet 
  &lt;/servlet-class&gt; 
  &lt;load-on-startup&gt;10&lt;/load-on-startup&gt; 
  &lt;/servlet&gt; 
  &lt;servlet-mapping&gt; 
  &lt;servlet-name&gt;velocity&lt;/servlet-name&gt; 
  &lt;url-pattern&gt;*.vm&lt;/url-pattern&gt; 
  &lt;/servlet-mapping&gt; 
  </code></pre>
  
  <p>............................................................................................. </p>
  
  <p>Now my question is how to set `</p>
  
  <pre><code> &lt;servlet-mapping&gt;
  </code></pre>
  
  <p>`, its only for velocity, or simemesh or has to be set differently </p>
  
  <p>Please let me know how to proceed,if can please reply with complete web.xml and others steps to be followed. </p>
  
  <p>Regards </p>
  
  <p>T.Thamilvaanan</p>