Ralph,

I think your approach could meet my requirements, in the sense it seems to
easily separate business and presentation. Where could I learn more on your
approach? I have a small knowledge of Cocoon and have only developped XSP
pages and sitemaps. 

Thanks.

Olivier.

-----Message d'origine-----
De : Ralph Goers [mailto:[EMAIL PROTECTED] 
Envoy� : mardi 30 d�cembre 2003 01:07
� : '[EMAIL PROTECTED]'
Objet : RE: Performing actions


I can tell you how we are doing it, although I can't make the source
available.  

I wrote a BusinessDelegate component. Each business delegate is defined in
cocoon.xconf as:

<business-delegates>
        <business-delegate name="getData">
            <className>busdelegate.Service</className>
            <getMethod>getData</getMethod>
            <constructorParameters>
                <parameter name="properties" type="java.util.Properties"
                           role="JNDIInitialContext"/>
            </constructorParameters>
            <parameters>
            <parameter name="sessionDto" type="SessionInfo"
inputModule="DTOModule"/>
            </parameters>
        </business-delegate>
        <business-delegate name="SetData">
            <className>busdelegate.Service</className>
            <getMethod>setData</getMethod>
            <constructorParameters>
                <parameter name="properties" type="java.util.Properties"
                           role="JNDIInitialContext"/>
            </constructorParameters>
            <parameters>
                <parameter name="sessionDto" type="SessionInfo"
inputModule="DTOModule"/>
                <parameter name="dto" type="DataDto"
inputModule="DTOModule"/>
            </parameters>
        </business-delegate>
<business-delegates>

I then have a BusinessDelegateAction that takes the business delegate name
as the src parameter.  The action invokes the business delegate by calling
the appropriate BusinessDelegate instance. It save the returned Data
Transfer Object in the request.  I then have a generator that converts the
Data Transfer Object to XML using Betwixt.  As long as the Data Transfer
Objects are constructed "nicely", Betwixt creates great XML.

The advantage of this is that I have the following Cocoon classes:
BusinessDelegateAction BusinessDelegate BeanGenerator DTOModule (generates
input DataTransferObjects from request parameters using BeanUtils).
PropertiesComponent (creates a properties object that contains the EJB
properties needed to do the JNDI lookup).

None of these have any knowledge of the business delegates. The business
delegates themselves are completely independent of Cocoon. Each
BusinessDelegate is configured to call a specific business delegate as
required.

Ralph

> -----Original Message-----
> From: Olivier RICHAUD [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 29, 2003 3:50 PM
> To: [EMAIL PROTECTED]
> Subject: Performing actions
> 
> 
> Hi all,
> 
> We are using Cocoon as our presentation layer. The backend is
> made of EJB
> which interact with 2 databases. The glue, when needed, 
> between EJB and
> Cocoon XSP pages is based on servlets. For example, when a form is
> submitted, the update jobs is done by servlets and depending 
> on the outcome,
> forwarded to the appropriate XSP page. 
> 
> Using servlets is not well appropriated as the flow is, like
> a bit like
> Struts, concentrated in the sitemap. Is there a way to do a 
> better job in a
> Cocoon way? Using actions, for example? Would it result in 
> transforming all
> our servlets into actions? And what would be the advantage of 
> doing this?
> 
> Thanks and happy new year.
> 
> 
> Olivier.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to