struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sundararaman, Anand" <Anand.Sundarara...@ps.net>
Subject RE: Struts2-Spring Integration Issue
Date Sat, 14 Feb 2009 16:24:01 GMT
Hi,
 Here are the files. I have just pasted only the contents to highlight the problem. The CreateUserAction
has two methods, execute() and doActivateUser(). The execute is called for "saveUser" action.
The doActivateUser() is called for "activateUser" action. If I specify the scope=prototype,
the doActivateUser() fails. If I remove the scope=prototype, the doActivateUser() works but
I loose thread safety. I want thread safety as well as able to use the do*() methods called
from actions.

<?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.ui.theme" value="main" />
   <constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory"
/> 
   <constant name="struts.devMode" value="true" />
   <constant name="struts.objectFactory.spring.autoWire" value="name" />

   <include file="struts-default.xml"/>
   
      <package name="default" namespace = "/" extends="struts-default">
.........
.........
      
      <action name="newUser">
         <result>/jsp/user/userregistration.jsp</result>    
      </action>  
      
      <action name="saveUser" class="createUser">
         <result name="success">/jsp/user/saveuser.jsp</result>   
         <result name="error">/jsp/user/userregistration.jsp</result>        
      
      </action>
      
      <action name="activateUser" class="createUser" method="activateUser">
         <result  name="success">/jsp/user/useractivated.jsp</result>        
   
         <result  name="error">/jsp/user/login.jsp</result>
      </action>
   </package>
   
  
</struts>

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
.....
.......
......
        <bean id="createUser" class="CreateUserAction" scope="prototype">
        <property name="userService">
            <ref bean="userServiceTarget"/>
        </property> 
 </bean> 
     <bean id="userServiceTarget" class="UserService">
      <property name="UserDAO">
            <ref bean="UserDAOTarget"/>
        </property>   
     </bean> 
   
     <bean id="UserDAOTarget"
        class="UserDAO" >
         <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>        
        </bean>  
.....
......
</beans>



________________________________________
From: Lukasz Lenart [lukasz.lenart@googlemail.com]
Sent: Saturday, February 14, 2009 10:01 AM
To: Struts Users Mailing List
Subject: Re: Struts2-Spring Integration Issue

Could you copy-paste your struts.xml and Spring config regarding actions?


Regards
--
Lukasz
http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message