cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shai200 <>
Subject Re: How to inject the result of an action into a generator
Date Wed, 26 Mar 2008 02:45:38 GMT

Alright, so since you're already in the groove of answering my questions
(thanks btw), I would need my generator class to also have access to the
entire Request Map (preferably in the form Map<String,String[]> where the
String[] key is the set of values in case a value is declared twice, but
that's not so crucial) as well as the Session object / map... how would I go
about that?


solprovider-2 wrote:
> On 3/25/08, shai200 <> wrote:
>>  This requirement is the primary function that I'll need from Cocoon,
>>  otherwise it's not good for me and I'll have to find some other servlet
>>  generating framework.
>>  I have a system where I have objects generating XHTML code based on some
>>  input I give them (other XML descriptors, Database queries, etc.). I'm
>>  looking for a way to take this HTML output and apply transformation on
>> it
>>  for further styling. Cocoon pipelines would be perfect for that, but
>>  unfortunately I am starting to understand that I'll still need to create
>>  separate servlets that provide the HTML output and then inject it into
>>  Cocoon, which is a stupid thing to do because I am looking for a way to
>>  create my servlets in the first place.
>>  What I require is an "Action Generator" (rather than the existing
>>  FileGenerator) that takes XHTML output that a POJO (i.e. and Action
>> class)
>>  returns and then moves it down the pipeline.
>>  Perhaps someone can suggest another framework that can achieve this?
> You do not need Actions.  You may never need Actions.  Most uses of
> Actions are better handled by other components.  Please forget you
> ever heard of Cocoon Actions.
> Did you know that the "src" parameter can use many protocols including
> "http:" and "ftp:"?  If XHTML (or any XML) is being generated by a
> servlet, you can use:
>    <map:generate src=""/>
> You could also pass querystring parameters to your generate:
>    <map:generate
> src="{request-param:xmlDescriptor}&{request-param:query}"/>
> But wait, Cocoon provides more for the same low price.  Generators are
> Java so you do not need to create servlets.  A custom Generator can
> use your POJOs!  (You are already creating an Action so I assume you
> program Java.)  This exactly meets your specifications for an
> "ActionGenerator".
> <map:generate type="myActionGenerator">
>    <map:param name="xmlDescriptor" value="something"/>
>    <map:param name="query" value="databaseQuery"/>
> </map:generate>
> The definition of a custom Generator is an XML source that is created
> with custom Java code and will be processed by other Cocoon components
> (at least a Serializer, but also as many Transformers as you wish!)  A
> custom Generator will handle all the requirements you have mentioned
> without the headaches you have encountered while attempting to use the
> wrong component for the task.
> solprovider
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Cocoon - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message