• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Velocity + Struts2 + Sitemesh + Spring +Hibernate Integration How to configur web.xml?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

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.

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.

Of course as illustrated in this example http://www.rkcole.com/articles/struts/crudTutorial/step4.html
sitemesh and spring can be integrated with struts2 configuring web.xml as


<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>


<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>


Now my task is to integrate velocity with this combination...............

Normally to integrate Velocity and struts2 I use the following

<servlet-class>
org.apache.velocity.tools.view.servlet.VelocityViewServlet
</servlet-class>
<load-on-startup>10</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>

.............................................................................................

Now my question is how to set <servlet-mapping>, its only for velocity, or simemesh or differently


Please let me know how to proceed,if can please reply with complete web.xml and others steps to be followed.

Regards

T.Thamilvaanan
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just use the default Velocity result. Note, however, that S2's Velocity support isn't as strong as the FreeMarker support--the error handling in FreeMarker is much stronger.

Someone else will have to chime in about SiteMesh, I've used it only rarely.

Spring support is strong via the Struts 2 Spring plugin.
 
Thiyagaraja Thamilvaanan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Just use the default Velocity result. Note, however, that S2's Velocity support isn't as strong as the FreeMarker support--the error handling in FreeMarker is much stronger.

Someone else will have to chime in about SiteMesh, I've used it only rarely.

Spring support is strong via the Struts 2 Spring plugin.




Thanks David,
I got some good ideas from your reply.

and this also helped me a lot.

http://struts.apache.org/2.0.6/docs/sitemesh-plugin.html
 
Thiyagaraja Thamilvaanan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya, finally I got this web.xml after lots of reading and searching............




Hope this is fine,will test and let you know.

Cheers............

Regards
Thamilvaanan
 
Screaming fools! It's nothing more than a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic