cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <dho...@csir.co.za>
Subject Re: Passing a parameter to flow from sitemap
Date Wed, 18 Jan 2006 12:34:38 GMT
Thanks Andre

That was actually the first approach I used... and it does
not work.  When I went looking for more info, I came across
the wiki page on "Best Practice", which says:

"Explicitly pass parameters from your sitemap to flowscript, 
rather than asking for arbitrary parameters from request (etc.) 
in flowscript, as the sitemap will quickly show you what the 
input contract required by the flowscript should be."
http://wiki.apache.org/cocoon/CocoonBestPractices 

Hence my attempted use of the parameter method.. but
that does not work (yet?!) either.

Derek

>>> Andre.Juffer@oulu.fi 2006/01/18 02:25 PM >>>
Derek Hohls wrote:
> Geert
> 
> Thanks for the detailed reply.
> 
> Actually, I want to pass a session attribute value to flowscript.
> I am using this syntax:
> 
> <map:parameter name="myid" value="{session-attr:myID}"/>
> 
> But this gives the same error as the one I describe below.
> (I know the value is not null because I can pass the same
> parameter to a stylesheet and it shows up OK).
> 
> Is there a "magical" way of doing this, too?

In flow:

cocoon.session.getAttribute("myvar");

if myvar is a session attribute.


> 
> Thanks
> Derek
> 
> (PS And does the code shown in the manual actually work as written??)
> 
> 
>>>> Geert.Josten@daidalos.nl 2006/01/18 02:06 PM >>>
> 
> If you want to pass 'global' parameters to flowscript, then you can define them as sitemap
globals 
> and access the global input module from flowscript.
> 
> in sitemap:
> <map:component-configurations>
> <myvar>blabla</myvar>
> </map:component-configurations>
> 
> <!-- to pass to XSLT -->
> <map:parameter name="myvar" value="{global:myvar}" />
> 
> in flowscript:
> importPackage(Packages.org.apache.cocoon.components.modules.input);
> var global = cocoon.getComponent(InputModule.ROLE + "Selector").select("global");
> var myvar = global.getAttribute("myvar",null,null);
> 
> Cheers,
> Geert
> 
> Derek Hohls wrote:
> 
> 
>>This should be a trivial operation, but is not working:
>>
>>As per the manual 
>>(http://cocoon.apache.org/2.1/userdocs/flow/sitemap.html), 
>>I have:
>>
>>Sitemap:
>><map:script src="script/dbtest.js">
>><map:parameter name="test" value="foo"/>
>></map:script>
>>
>>In dbtest.js:
>>
>>//param - below is line 33....
>>var thisTest = cocoon.parameters.test;
>>
>>which results in this error:
>>
>>An Error Occurred
>>Cannot convert null to an object.
>>org.apache.avalon.framework.CascadingRuntimeException: Cannot convert null to an object.
>>cause: TypeError: Cannot convert null to an object. (file:/.../dbtest.js; line 33)
>>
>>Any ideas how to succesfully pass a parameter to flow?
>>
>>Thanks
>>Derek
>>
>>PS Running Cocoon 2.1.5, JDK 1.4.x 
>>
>>
> 
> 


-- 
Andre H. Juffer | Phone: +358-8-553 1161
The Biocenter and | Fax: +358-8-553-1141
the Dep. of Biochemistry | Email: Andre.Juffer@oulu.fi 
University of Oulu, Finland | WWW: www.biochem.oulu.fi/Biocomputing/ 

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



-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
HelpDesk@csir.co.za.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


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


Mime
View raw message