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 <[EMAIL PROTECTED]> 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: [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