Hi Peder,

This looks ok for me, try by adding "struts.objectFactory = spring" into struts.properties file and see

Thanks,

Nuwan.

----- Original Message ----- From: "Peder Larsen" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Saturday, December 23, 2006 3:31 AM
Subject: Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work.


Ok my config is:
applicationContext.xml,
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xmlns:aop="http://www.springframework.org/schema/aop";
      xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd";>

   <bean id="userInfo" class="models.UserInfo" autowire="byType"
scope="session"></bean>
   <bean id="indexAction" class="actions.IndexAction" scope="prototype">
       <property name="userInfo" ref="userInfo" />
   </bean>
</beans>
struts.xml,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
   "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
   "http://struts.apache.org/dtds/struts-2.0.dtd";>
<struts>
   <constant name="struts.objectFactory" value="spring"></constant>
   <package name="unrestrictedActions" extends="struts-default" >
       <interceptors>
         <interceptor name="login" class="interceptor.LoginInterceptor"/>
         <interceptor-stack name="secureStack">
           <interceptor-ref name="login"/>
           <interceptor-ref name="defaultStack"/>
         </interceptor-stack>
       </interceptors>

       <default-interceptor-ref name="secureStack"/>

       <action name="index" class="indexAction">
           <result type="freemarker">/ftl/index.ftl</result>
       </action>
   </package>
</struts>
web.xml,
<?xml version="1.0" encoding="UTF-8"?>

<web-app id="starter" version="2.4"
   xmlns="http://java.sun.com/xml/ns/j2ee";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>

 <display-name>Test webapp</display-name>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:applicationContext*.xml</param-value>
  </context-param>

   <filter>
       <filter-name>action2-cleanup</filter-name>
       <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
   </filter>
   <filter>
       <filter-name>action2</filter-name>
       <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
   </filter>
   <filter>
       <filter-name>requestContextFilter</filter-name>
       <filter-class>org.springframework.web.filter.RequestContextFilter
</filter-class>
   </filter>
   <filter-mapping>
       <filter-name>requestContextFilter</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>
   <filter-mapping>
       <filter-name>action2-cleanup</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>
   <filter-mapping>
       <filter-name>action2</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>

   <listener>
       <listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
   <welcome-file-list>
       <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>
</web-app>

Whew! That is a long listing, i've also tried with the
org.springframework.web.context.request.RequestContextListener listener but
run in the same problem.

Also tried what nuwan chandrasoma suggested in the thread above this but
i've already tried that.

So anyone spots whats missing?

Thanks for all help.
On 12/23/06, Wendy Smoak <[EMAIL PROTECTED]> wrote:

On 12/22/06, Peder Larsen <[EMAIL PROTECTED]> wrote:

> I've been trying for some time now to get my basic struts2 test up and
> running. The problem i have is that i need to inject one UserInfo pr
session
> into my FooAction. I want to use spring2 for this since it has better
> "scope" support than spring1.

Are you using the 2.0.1 beta release?

> Anyone know what i might do to fix it?

Post the relevant parts of your configuration files and code, and see
if someone can spot the problem.

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to