cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Reijn <j.re...@hippo.nl>
Subject Re: set a session attribute in the sitemap
Date Tue, 19 Dec 2006 19:01:17 GMT
Hi Mark,

sure:

First of you need to define the action with a specific 'mode'
<map:actions>
<map:action name="setteraction"
         src="org.apache.cocoon.acting.SetterAction">
    <parameter name="mode" value="session-attribute"/>
</map:action>
</map:actions>

You have three options for the mode: 'session-attribute', 
'request-attribute' and the default is 'object-model'.

Then you define the matcher in your sitemap:

<map:match pattern="setteraction">
   <map:act type="setteraction">
     <map:parameter name="setmyaction" value="'123'"/>
   </map:act>
   <map:generate src="empty.xml"/>
   <map:serialize type="xml"/>
</map:match>


And you are now able to retrieve the value from flowscript:

function getMySessionParameter()
{
    print(cocoon.session.getAttribute("setmyaction"));
}

I could write some java doc code and supply it as a patch in JIRA?

WDYT?

Kind regards,

Jeroen Reijn


Mark Lundquist wrote:
> 
> On Dec 18, 2006, at 7:00 AM, Jeroen Reijn wrote:
> 
>> Or use the SetterAction
>>
>> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/acting/SetterAction.html 
>>
> 
> Jeroen, can you post an example of how to use the SetterAction?  The 
> sitemap usage model wasn't clear to me from the API.
> 
> thx,
> —ml—
> 
> P.S. I know how to use the SessionPropagatorAction and I'm not trying to 
> solve any particular problem here... I'm just curious about SetterAction 
> specifically.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

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


Mime
View raw message