mercredi 6 janvier 2010

How to integrate Spring & Struts2 into your web application

In order to integrate these two frameworks, you need to declare each utilization in the web.xml file.

The content of your web descriptor file should be:

The first filter declaration represent the Struts 2 filter. It's necessary in your web application, if you decide to use Struts 2 into your web application architecture:


The filter mapping of your Struts 2 filter is mapped to all requests coming into your web application, but you can provide a specific url pattern like : /GUI

In this example:

struts2 --> /*

All requests coming into you web application with .action extension will normally be processed as a Struts Action.

After that, you need to declare the Spring listener which handler and manage your Spring Web Application Context. The ContextLoaderListener will load the Spring applicationContext.xml file and manage each call to its context. Also, its enable the Spring object factory and the wiring interceptors


Aucun commentaire:

Enregistrer un commentaire