You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by georgievh <ge...@yahoo.co.uk> on 2008/03/30 04:15:46 UTC

Initializing Actions from Spring


Hi,

I am trying to initialize Struts2 Actions from Spring.
I have done this successfully using struts2 xml configuration files.
However, I did not have the same success when using annotations.

Could anyone please explain how I can achieve this.

Here is my approach:
In file MainpageAction.java I have:
...
@Result( name="success", value="mainpage.page", type=TilesResult.class )
...

In applicationContext.xml I have:
…
		<bean id="mainpageAction"
			class="com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction"
			autowire="autodetect"
			singleton="false">
		<constructor-arg>
			<value>Buenos Dias!</value>
		</constructor-arg>
	</bean>
…

Thank you in advance for your help
-- 
View this message in context: http://www.nabble.com/Initializing-Actions-from-Spring-tp16377674p16377674.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Initializing Actions from Spring

Posted by Laurie Harper <la...@holoweb.net>.
Your action mapping has class="mainpage", but your Spring configuration 
has id="mainpageAction". These should be the same. I'm not quite sure 
how you're getting the error you are, though, based on that 
configuration. And I don't see how introducing an @Result annotation 
would effect it. I suspect you have some out-of-date config files 
deployed or something, since the error is inconsistent with what you 
show here.

Try doing a clean build/deploy and check that the deployed configuration 
is what you think it is. One other point to check: do you have the 
struts2-spring plugin deployed? You need that to allow your actions to 
be managed by Spring.

L.

georgievh wrote:
> Every thing works perfectly if I do not use annotations but use configuration
> xml files.
> My annotation part is as follows:
> @Result( 
>                 name="success", 
>                 value="mainpage.page", 
>                 type=TilesResult.class)
> 
> I use the following configuration in an xml file and it works:
>     <package name="mainpage" namespace="/" extends="tiles-default">
>         <action name="mainpage" class="mainpage">
>             <result name="success" type="tiles">mainpage.page</result>
>         </action>
> 
>         <!-- Add actions here -->
>     </package>
> 
> Using annotations I have error message (look below)
> 
> From the error message I think that Struts is trying to create my Action
> object and it fails because I do not have a default constructor.
> It could be the case, thought, that Spring managed to successfully create
> the object but I do not refer to it the right way.
> In my applicationContext.xml I have:
>         <bean id="mainpageAction" 
>                        
> class="com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction" 
>                         autowire="autodetect" 
>                         singleton="false"> 
>                 <constructor-arg> 
>                         <value>Buenos Dias!</value> 
>                 </constructor-arg> 
>         </bean>
> 
> Does my id have the right value (id=”mainpageAction”)?
> 
> 
> 
> ERROR:
> =======
> type Exception report
> 
> message
> 
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
> 
> exception
> 
> javax.servlet.ServletException: Unable to intantiate Action!
> 	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
> 
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
> 
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 
> root cause
> 
> Unable to intantiate Action!
> 
> com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:277)
> 
> com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365)
> 
> com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
> 
> com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83)
> 
> com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> 
> com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74)
> 
> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
> 
> org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
> 	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
> 
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
> 
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 
> root cause
> 
> java.lang.InstantiationException:
> com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction
> 	java.lang.Class.newInstance0(Class.java:335)
> 	java.lang.Class.newInstance(Class.java:303)
> 	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:123)
> 
> com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:148)
> 
> com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:128)
> 	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:143)
> 	com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:113)
> 
> com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:275)
> 
> com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365)
> 
> com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
> 
> com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83)
> 
> com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> 
> com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74)
> 
> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
> 
> org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
> 	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
> 
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
> 
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 
> note The full stack trace of the root cause is available in the
> JBossWeb/2.0.1.GA logs.
> JBossWeb/2.0.1.GA
> 
> 



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


Re: Initializing Actions from Spring

Posted by georgievh <ge...@yahoo.co.uk>.
Every thing works perfectly if I do not use annotations but use configuration
xml files.
My annotation part is as follows:
@Result( 
                name="success", 
                value="mainpage.page", 
                type=TilesResult.class)

I use the following configuration in an xml file and it works:
    <package name="mainpage" namespace="/" extends="tiles-default">
        <action name="mainpage" class="mainpage">
            <result name="success" type="tiles">mainpage.page</result>
        </action>

        <!-- Add actions here -->
    </package>

Using annotations I have error message (look below)

>From the error message I think that Struts is trying to create my Action
object and it fails because I do not have a default constructor.
It could be the case, thought, that Spring managed to successfully create
the object but I do not refer to it the right way.
In my applicationContext.xml I have:
        <bean id="mainpageAction" 
                       
class="com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction" 
                        autowire="autodetect" 
                        singleton="false"> 
                <constructor-arg> 
                        <value>Buenos Dias!</value> 
                </constructor-arg> 
        </bean>

Does my id have the right value (id=”mainpageAction”)?



ERROR:
=======
type Exception report

message

description The server encountered an internal error () that prevented it
from fulfilling this request.

exception

javax.servlet.ServletException: Unable to intantiate Action!
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)

org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)

org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

Unable to intantiate Action!

com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:277)

com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365)

com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)

com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83)

com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)

com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74)

com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)

org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)

org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)

org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

java.lang.InstantiationException:
com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction
	java.lang.Class.newInstance0(Class.java:335)
	java.lang.Class.newInstance(Class.java:303)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:123)

com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:148)

com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:128)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:143)
	com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:113)

com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:275)

com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365)

com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)

com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83)

com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)

com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74)

com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)

org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)

org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)

org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

note The full stack trace of the root cause is available in the
JBossWeb/2.0.1.GA logs.
JBossWeb/2.0.1.GA


-- 
View this message in context: http://www.nabble.com/Initializing-Actions-from-Spring-tp16377674p16392737.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Initializing Actions from Spring

Posted by Laurie Harper <la...@holoweb.net>.
So what *is* the problem? Is Spring not loading the action? Is Struts 
not finding the action? Something else? The code/configuration you've 
posted looks basically OK.

L.

georgievh wrote:
> Sorry for the misleading.
> 
> I have a constructor.
> 
> The class is actually as follows:
> 
> package com.gbsoft.belfin.communitypages.actions.mainpage;
> 
> import java.lang.Exception;
> 
> import org.apache.struts2.config.Result;
> import org.apache.struts2.views.tiles.TilesResult;
> 
> import com.opensymphony.xwork2.ActionSupport;
> 
> 
> 
> @Result(
>                 name="success",
>                 value="mainpage.page",
>                 type=TilesResult.class)
> public class MainpageAction extends ActionSupport {
>         private String message;
> 
> 	public MainpageAction( String message ){
> 		this.message = message;
> 	}
>        
>         public String execute() throws Exception {
>                 return SUCCESS;
>         }
>        
>         public String getMessage() { return message; }
>        
>         public void setMessage(String message) {
>                 this.message = message;
>         }
> }


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


Re: Initializing Actions from Spring

Posted by georgievh <ge...@yahoo.co.uk>.
Sorry for the misleading.

I have a constructor.

The class is actually as follows:

package com.gbsoft.belfin.communitypages.actions.mainpage;

import java.lang.Exception;

import org.apache.struts2.config.Result;
import org.apache.struts2.views.tiles.TilesResult;

import com.opensymphony.xwork2.ActionSupport;



@Result(
                name="success",
                value="mainpage.page",
                type=TilesResult.class)
public class MainpageAction extends ActionSupport {
        private String message;

	public MainpageAction( String message ){
		this.message = message;
	}
       
        public String execute() throws Exception {
                return SUCCESS;
        }
       
        public String getMessage() { return message; }
       
        public void setMessage(String message) {
                this.message = message;
        }
}
-- 
View this message in context: http://www.nabble.com/Initializing-Actions-from-Spring-tp16377674p16384701.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Initializing Actions from Spring

Posted by Dave Newton <ne...@yahoo.com>.
Did you say the problem was that the "message" property wasn't being
initialized?

I see a ctor arg in the Spring config, but I don't see any ctors in the
action class itself; is Spring able to "do the right thing" in this case?
I've always either used explicit ctors or set properties directly.

Dave

--- georgievh <ge...@yahoo.co.uk> wrote:

> 
> Thank you for the reply.
> 
> I am new to both Spring and Struts2 and I apologise in advance should my
> mistake is a silly one.
> Please find the relevant code bellow:
> 
> web.xml:
> ============
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> 
> <web-app >
>  	<context-param>
> 	
>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
> 		<param-value>
> 			/WEB-INF/tiles-definitions/elements/logo/logo.xml,
> 			/WEB-INF/tiles-definitions/elements/widebanner/widebanner.xml,
> 			/WEB-INF/tiles-definitions/elements/footer/footer.xml,
> 			/WEB-INF/tiles-definitions/elements/navigation/navigation.xml,
> 			/WEB-INF/tiles-definitions/layouts/layouts.xml,
> 			/WEB-INF/tiles-definitions/pages/mainpage/mainpage.xml
> 		</param-value>
> 	</context-param>
> 	
>   	<filter>
> 		<filter-name>struts2</filter-name>
> 	
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
> 		<init-param>
> 			<param-name>actionPackages</param-name>
> 			<param-value>
> 				com.gbsoft.belfin.communitypages.actions.mainpage
> 			</param-value>
> 		</init-param>
> 	</filter>
> 
>   	<filter-mapping>
> 		<filter-name>struts2</filter-name>
> 		<url-pattern>/*</url-pattern>
> 	</filter-mapping>
> 
>   	<listener>
> 		<listener-class>
> 			org.springframework.web.context.ContextLoaderListener
> 		</listener-class>
> 	</listener>
> 
> 	<listener>
> 		<listener-class>
> 			org.apache.struts2.tiles.StrutsTilesListener
> 		</listener-class>
> 	</listener>
> 
> 
>    	<welcome-file-list>
> 		<welcome-file>/WEB-INF/jsp/index.jsp</welcome-file>
> 	</welcome-file-list>
> 
>   
> 
> </web-app>
> 
> ----------------------------
> 
> applicationContext.xml
> =================
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
> 	"http://www.springframework.org/dtd/spring-beans.dtd">
> 
> <beans>
> 
> 	<bean id="mainpageAction"
> 			class="com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction"
> 			singleton="false">
> 		<constructor-arg>
> 			<value>Buenos Dias!</value>
> 		</constructor-arg>
> 	</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 name="struts.enable.DynamicMethodInvocation" value="false" />
> 	<constant name="struts.devMode" value="true" />    
> 	<constant name="struts.action.extension" value="htm" />
>     
> 
>     <!-- Add packages here -->
> 
> </struts>
> --------------------
> 
> MainpageAction.java:
> ================
> package com.gbsoft.belfin.communitypages.actions.mainpage;
> 
> import java.lang.Exception;
> 
> import org.apache.struts2.config.Result;
> import org.apache.struts2.views.tiles.TilesResult;
> 
> import com.opensymphony.xwork2.ActionSupport;
> 
> 
> 
> @Result(
> 		name="success", 
> 		value="mainpage.page",
> 		type=TilesResult.class)
> public class MainpageAction extends ActionSupport {
> 	private String message;
> 	
> 	public String execute() throws Exception {
> 		return SUCCESS;
> 	}
> 	
> 	public String getMessage() { return message; }
> 	
> 	public void setMessage(String message) {
> 		this.message = message;
> 	}
> }
> -- 
> View this message in context:
>
http://www.nabble.com/Initializing-Actions-from-Spring-tp16377674p16384249.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Initializing Actions from Spring

Posted by georgievh <ge...@yahoo.co.uk>.
Thank you for the reply.

I am new to both Spring and Struts2 and I apologise in advance should my
mistake is a silly one.
Please find the relevant code bellow:

web.xml:
============
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app >
 	<context-param>
	
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
		<param-value>
			/WEB-INF/tiles-definitions/elements/logo/logo.xml,
			/WEB-INF/tiles-definitions/elements/widebanner/widebanner.xml,
			/WEB-INF/tiles-definitions/elements/footer/footer.xml,
			/WEB-INF/tiles-definitions/elements/navigation/navigation.xml,
			/WEB-INF/tiles-definitions/layouts/layouts.xml,
			/WEB-INF/tiles-definitions/pages/mainpage/mainpage.xml
		</param-value>
	</context-param>
	
  	<filter>
		<filter-name>struts2</filter-name>
	
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
		<init-param>
			<param-name>actionPackages</param-name>
			<param-value>
				com.gbsoft.belfin.communitypages.actions.mainpage
			</param-value>
		</init-param>
	</filter>

  	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

  	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

	<listener>
		<listener-class>
			org.apache.struts2.tiles.StrutsTilesListener
		</listener-class>
	</listener>


   	<welcome-file-list>
		<welcome-file>/WEB-INF/jsp/index.jsp</welcome-file>
	</welcome-file-list>

  

</web-app>

----------------------------

applicationContext.xml
=================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
	"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

	<bean id="mainpageAction"
			class="com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction"
			singleton="false">
		<constructor-arg>
			<value>Buenos Dias!</value>
		</constructor-arg>
	</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 name="struts.enable.DynamicMethodInvocation" value="false" />
	<constant name="struts.devMode" value="true" />    
	<constant name="struts.action.extension" value="htm" />
    

    <!-- Add packages here -->

</struts>
--------------------

MainpageAction.java:
================
package com.gbsoft.belfin.communitypages.actions.mainpage;

import java.lang.Exception;

import org.apache.struts2.config.Result;
import org.apache.struts2.views.tiles.TilesResult;

import com.opensymphony.xwork2.ActionSupport;



@Result(
		name="success", 
		value="mainpage.page",
		type=TilesResult.class)
public class MainpageAction extends ActionSupport {
	private String message;
	
	public String execute() throws Exception {
		return SUCCESS;
	}
	
	public String getMessage() { return message; }
	
	public void setMessage(String message) {
		this.message = message;
	}
}
-- 
View this message in context: http://www.nabble.com/Initializing-Actions-from-Spring-tp16377674p16384249.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Initializing Actions from Spring

Posted by mg...@hotmail.com.
pls display contents of your xwork.xml
and the configuration of the spring listener you are referencing in web.xml

http://www.opensymphony.com/webwork/wikidocs/Other%20Spring%20Integration.ht
ml

Thanks
Martin-
----- Original Message -----
Wrom: TLBXFGGMEPYOQKEDOTWFAOBUZXUWLSZLKBR
To: <us...@struts.apache.org>
Sent: Saturday, March 29, 2008 9:15 PM
Subject: Initializing Actions from Spring




Hi,

I am trying to initialize Struts2 Actions from Spring.
I have done this successfully using struts2 xml configuration files.
However, I did not have the same success when using annotations.

Could anyone please explain how I can achieve this.

Here is my approach:
In file MainpageAction.java I have:
..
@Result( name="success", value="mainpage.page", type=TilesResult.class )
..

In applicationContext.xml I have:
…
<bean id="mainpageAction"
class="com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction"
autowire="autodetect"
singleton="false">
<constructor-arg>
<value>Buenos Dias!</value>
</constructor-arg>
</bean>
…

Thank you in advance for your help
--
View this message in context:
http://www.nabble.com/Initializing-Actions-from-Spring-tp16377674p16377674.h
tml
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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