cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Cocoon Wiki] Update of "PerlScriptGenerator" by FosterHersey
Date Tue, 14 Feb 2006 23:09:31 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change notification.

The following page has been changed by FosterHersey:

New page:
===  Download ===
Download the bsfperl.jar from [] and put it into the WEB-INF/lib
directory of your webapp. If you want to rebuild your Cocoon you should copy it also to the
lib/local directory of your Cocoon sources, otherwise the JAR will be lost after the build.

===  Sitemap entry ===
<map:match pattern="">
  <map:generate src="" type="script">
    <map:parameter name="userName" value="Perl Lover"/>
  <map:serialize type="xml"/>

===  Perl script ( ===

use strict;

# a bean scripting framework object, 
# $bsf, is provided to us by bsfperl.

#get the output String buffer
my $bsf_output = $bsf->lookupBean("output");

#get the Parameters object
my $bsf_parameters = $bsf->lookupBean("parameters");

#get the value of the parameter "key" defined in the sitemap
my $username = $bsf_parameters->getParameter("userName");

#generate xml
$bsf_output->append("<xml>" . "Hello, " . $username . "!" . "</xml>");

(tested with 2.1.8)

===  See Also ===
 *[ ScriptGenerator in Cocoon 2.1]

View raw message