You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrei Svirida <an...@midray.com> on 2002/06/21 20:58:41 UTC

Passing sitemap parameters between actions

Hello Cocoon sers,

I have a little problem with passing sitemap parameters between
actions, hopefully someone knowns the solution.

I have something like this in my sitemap:
------
<map:match pattern="login.html">

   <!-- Authenticator writes the error message in sitemap variable
   {errormessage} -->
   
   <map:act type="authenticator">
     ...
   </map:act>

   <!-- Transformer wants to access the error message from the
   stylesheets -->
   
   <map:transform src="stylesheets/midray-html.xsl">
       <map:parameter name="errormessage" value="{<???errormessage from authetificator??>}"/>
   </map:transform>


</map:match>
-----
My problem is that the sitemap variable "errormessage" is not valid
outside of <map:act type="authenticator">, so i can't use it inside
transformer.

I know that this problem can be solved by doing this:
---
<map:match pattern="login.html">

   <!-- Authenticator writes the error message in sitemap variable
   {errormessage} -->
   <map:act type="authenticator">

        <!-- Transformer wants to access the error message from the
            stylesheets -->
   
        <map:transform src="stylesheets/midray-html.xsl">
            <map:parameter name="errormessage" value="{errormessage}"/>
        </map:transform>
   

   </map:act>



</map:match>
---
but this solution has some disadvantages which i would like to avoid.

Any ideas?


   
        

      



--
Andrei Svirida, Projekte & Entwicklung
MIDRAY GmbH - a debitel company
Phone:  +49.221.8884 435 
Fax:    +49.221.8884 455

http://www.midray.com/


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Passing sitemap parameters between actions

Posted by Jonathan Layes <j....@layes.com>.
The map object is destroyed when the authenticator action is complete
so your only option is to copy the values somewhere before the action
completes.  Three places come to mind:  the parent parameter map,
the request parameters and the session (assuming you have a
session).   I know of SessionPropagatorAction to push values to 
the session but you'll have to brew your own action if you choose to
copy to the parent map or the request parameter list.  I'm not endorsing
any of these options as a good design - just pointing out what's possible.

As you already showed, nesting the transformer in the action works
and is the preferred way - try refactoring your sitemap if you can.

Cheers

On Fri, Jun 21, 2002 at 08:58:41PM +0200, Andrei Svirida wrote:
> Hello Cocoon sers,
> 
> I have a little problem with passing sitemap parameters between
> actions, hopefully someone knowns the solution.
> 
> I have something like this in my sitemap:
> ------
> <map:match pattern="login.html">
> 
>    <!-- Authenticator writes the error message in sitemap variable
>    {errormessage} -->
>    
>    <map:act type="authenticator">
>      ...
>    </map:act>
> 
>    <!-- Transformer wants to access the error message from the
>    stylesheets -->
>    
>    <map:transform src="stylesheets/midray-html.xsl">
>        <map:parameter name="errormessage" value="{<???errormessage from authetificator??>}"/>
>    </map:transform>
> 
> 
> </map:match>
> -----
> My problem is that the sitemap variable "errormessage" is not valid
> outside of <map:act type="authenticator">, so i can't use it inside
> transformer.
> 
> I know that this problem can be solved by doing this:
> ---
> <map:match pattern="login.html">
> 
>    <!-- Authenticator writes the error message in sitemap variable
>    {errormessage} -->
>    <map:act type="authenticator">
> 
>         <!-- Transformer wants to access the error message from the
>             stylesheets -->
>    
>         <map:transform src="stylesheets/midray-html.xsl">
>             <map:parameter name="errormessage" value="{errormessage}"/>
>         </map:transform>
>    
> 
>    </map:act>
> 
> 
> 
> </map:match>
> ---
> but this solution has some disadvantages which i would like to avoid.
> 
> Any ideas?
> 
> 
>    
>         
> 
>       
> 
> 
> 
> --
> Andrei Svirida, Projekte & Entwicklung
> MIDRAY GmbH - a debitel company
> Phone:  +49.221.8884 435 
> Fax:    +49.221.8884 455
> 
> http://www.midray.com/
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
> 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>