Hi Peder,
I have used spring2 with struts2 for a small example app.., it worked for
me, i will list you what i have done.
1. I have spring 2.0 jars and struts struts 2.0 jar
2. got hold of the applicationContext.xml for spring 2.0 , which has the DTD
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
3. change the web.xml to use the the new listener that enables the scope
variable in spring 2.0
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
4. coded my struts action they way it is mentioned in this post
http://jroller.com/page/TedHusted?entry=struts_2_spring_love_fest
5. add the lines to the applictionContext.xml which i want to inject to my
action, with socpe attribute speficed.
<beans default-autowire="autodetect">
<!-- add your spring beans here -->
<bean id="numGen" class="com.pine.beans.NumberGen" scope="request"/>
</beans>
6. in my action class i have the setter and getter method and the framework
will do the necessary things as i have enabled autodetect
private NumberGen numGen;
public NumberGen getNumGen() {
return numGen;
}
public void setNumGen(NumberGen numGen) {
this.numGen = numGen;
}
This is basically what i have done and its working fine for me.
Thanks,
Nuwan
----- Original Message -----
From: "Peder Larsen" <larsen.peder@(protected)>
To: <user@(protected)>
Sent: Saturday, December 23, 2006 1:22 AM
Subject: Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener
doesnt work.
> Ok,
> I think it would be better if some helpful soul which has successfully
> used
> struts2 with spring2 to simply add their struts.xml,
> applicationContext.xmland maybe also the
> pom.xml for the project here so i can have a look at it.
>
> Also maybe if you have the time shorten down the XMLs to only the
> important
> parts.
>
> Tried for several days now to get this IoC with session scope working with
> no luck, and I'm on the verge of giving it up. I really want to use
> struts2
> for my next project, but all this banging against the wall is frustrating.
>
> Again, best regards
> Peder Larsen
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)