cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: get parameters from sitemap to generator
Date Wed, 20 Jun 2007 20:32:36 GMT
On 20.06.2007 17:48, dalf wrote:

> I'm trying to get a parameter from the sitemap to my generator (java class)
> but I get an error : 
> "Internal Server Error
> Message: The parameter 'param1' does not contain a value "
> 
> Here is my sitemap :
> Generators : <map:generator name="testParam"
> src="org.erudit.cocoon.CocoonGeneratorTestParam">
> 
> Pipelines : 
> <map:pipeline>
> 	<map:match pattern="brute/*">
> 		<map:generate type="testParam">
> 			<map:parameter name="param1" value="gogogo"/>
> 		</map:generate>
> 		<map:serialize type="xml"/> 
> 	</map:match>
> </map:pipeline>
> 
> In my java class :
> public class CocoonGeneratorTestParam extends AbstractGenerator implements
> Poolable, Parameterizable {
> ....
> public void parameterize(Parameters parameters) throws ParameterException {
> 		this.param= parameters.getParameter("param1");
> 	}
> }
> 
> I can't get my parameter in my java class...

There are two different kinds of parameters. Those ones that are part of 
the component initialization. They have to be specified in the 
map:components section, actually as child nodes of your map:generator. 
This is what Parameterizable is about.

The second type of parameters are passed to the setup() method. That's 
map:parameter in the actual pipeline.

It's at least partly explained at [1]

Joerg

PS: Please consider asking such question not related to the development 
of Cocoon itself on the users list first.

[1] http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html

Mime
View raw message