//a good idea as long as the 2 libraries implement different activation 
mechanisms... here is a typical Struts Action filter
    <filter>
        <filter-name>struts-prepare</filter-name>
        
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
        <init-param>
            <param-name>actionPackages</param-name>
            <param-value>org.apache.struts2.showcase.person</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>struts-prepare</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

//activating SPRING via autowire
<struts>
    <bean type="com.opensymphony.xwork2.ObjectFactory" name="spring" 
class="org.apache.struts2.spring.StrutsSpringObjectFactory" />
    
    <!--  Make the Spring object factory the automatic default -->
    <constant name="struts.objectFactory" value="spring" />

    <package name="spring-default">
        <interceptors>
<!-- This autowires the above bean into the Action -->
            <interceptor name="autowiring" 
class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>
<!-- This autowires the above bean to the Session -->
            <interceptor name="sessionAutowiring" 
class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/>
        </interceptors>
    </package>    
</struts>

//and finally the injection parameters for StrutsSpringObjectFactory
    @Inject
    public StrutsSpringObjectFactory(
            
@Inject(value=StrutsConstants.STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE,required=false)
 String autoWire,
            
@Inject(value=StrutsConstants.STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE_ALWAYS_RESPECT,required=false)
 String alwaysAutoWire,
            
@Inject(value=StrutsConstants.STRUTS_OBJECTFACTORY_SPRING_USE_CLASS_CACHE,required=false)
 String useClassCacheStr,
            @Inject ServletContext servletContext) {

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Wed, 25 Nov 2009 12:25:38 -0430
> Subject: Re: Is Using Spring With Struts 2 A Good Idea?
> From: nesto...@gmail.com
> To: user@struts.apache.org
> 
> I've been using it for over 50 projects with excellent results. Once you
> start using spring in big projects you really can't go back.
> 
> On Wed, Nov 25, 2009 at 11:59 AM, phillips1021 <bphill...@ku.edu> wrote:
> 
> >
> > At the University of Kansas (#1 college basketball team :) we use Struts 2
> > for our web application framework.  Its worked very well for us.
> >
> > I've been learning the Spring framework and how to use it with Struts 2.  I
> > think the two frameworks work very well together.
> >
> > I'm preparing a class for the other Java developers on how to use Struts 2
> > and Spring together.  As part of my research I'd like to hear from other
> > Struts 2 developers on if you use Spring with Struts 2 and if you think its
> > a good or bad practice.
> >
> > Thanks in advance for any feedback you can provide on why or why not it's a
> > good idea to use Struts 2 with Spring.
> >
> > Bruce Phillips
> > http://www.brucephillips.name/blog http://www.brucephillips.name/blog
> >
> >
> > --
> > View this message in context:
> > http://old.nabble.com/Is-Using-Spring-With-Struts-2-A-Good-Idea--tp26515837p26515837.html
> > Sent from the Struts - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
                                          
_________________________________________________________________
Windows 7: It works the way you want. Learn more.
http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen:112009v2

Reply via email to