You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Schenk, Paul (SD/DS-Accenture)" <Pa...@gnb.ca> on 2009/03/04 16:08:23 UTC

Spring bean for action src

Hello,

We are trying to develop a Cocoon 2.2 application. We have developed a
few 2.1 apps already. We are struggling with using a spring bean for an
action.

We'd like to do something like:

(in sitemap.xmap)

  <map:components>
    <map:actions>
      <map:action name="nocache-action"
src="org.apache.cocoon.acting.HttpCacheAction">
          <seconds>2</seconds>
      </map:action>
      <map:action name="NBCLinkForm" src="LinkForm"/>
    </map:actions>
  </map:components>


We define the bean in applicationContext.xml:

<bean id="LinkForm" class="com.gnb.forms.LinkForm">
  <property name="dataSource" ref="dataSource" /> 
  </bean>

However the name LinkForm is never properly resolved. Is there a way to
use specify a Spring bean as an action source?

Thanks
paul



Re: Spring bean for action src

Posted by Paul Schenk <Pa...@gnb.ca>.
Thanks! That works!

paul

Andreas Hartmann wrote:
> 
> Hi Paul,
> 
> Schenk, Paul (SD/DS-Accenture) schrieb:
>> Hello,
>> 
>> We are trying to develop a Cocoon 2.2 application. We have developed a 
>> few 2.1 apps already. We are struggling with using a spring bean for an 
>> action.
>> 
>> We’d like to do something like:
>> 
>> (in sitemap.xmap)
>> 
>>   <map:components>
>> 
>>     <map:actions>
>> 
>>       <map:action name="nocache-action" 
>> src="org.apache.cocoon.acting.HttpCacheAction">
>> 
>>           <seconds>2</seconds>
>> 
>>       </map:action>
>> 
>>       <map:action name="NBCLinkForm" src="LinkForm"/>
>> 
>>     </map:actions>
>> 
>>   </map:components>
>> 
>> We define the bean in applicationContext.xml:
>> 
>> <bean id="LinkForm" class="com.gnb.forms.LinkForm">
> 
> I'm not sure, but I think that has to read
> 
> <bean name="org.apache.cocoon.acting.Action/LinkForm" 
> class="com.gnb.forms.LinkForm">
> 
> Then you should be able to reference the action with the name "LinkForm" 
> in your sitemap, without additionally declaring it in the 
> <map:components> section.
> 
> -- Andreas
> 
> 
> 
> -- 
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring-bean-for-action-src-tp22332048p22333703.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Spring bean for action src

Posted by Andreas Hartmann <an...@apache.org>.
Hi Paul,

Schenk, Paul (SD/DS-Accenture) schrieb:
> Hello,
> 
> We are trying to develop a Cocoon 2.2 application. We have developed a 
> few 2.1 apps already. We are struggling with using a spring bean for an 
> action.
> 
> We’d like to do something like:
> 
> (in sitemap.xmap)
> 
>   <map:components>
> 
>     <map:actions>
> 
>       <map:action name="nocache-action" 
> src="org.apache.cocoon.acting.HttpCacheAction">
> 
>           <seconds>2</seconds>
> 
>       </map:action>
> 
>       <map:action name="NBCLinkForm" src="LinkForm"/>
> 
>     </map:actions>
> 
>   </map:components>
> 
> We define the bean in applicationContext.xml:
> 
> <bean id="LinkForm" class="com.gnb.forms.LinkForm">

I'm not sure, but I think that has to read

<bean name="org.apache.cocoon.acting.Action/LinkForm" 
class="com.gnb.forms.LinkForm">

Then you should be able to reference the action with the name "LinkForm" 
in your sitemap, without additionally declaring it in the 
<map:components> section.

-- Andreas



-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org