cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Connell, Robert (SAPOL)" <robert.conn...@police.sa.gov.au>
Subject RE: Struts with cocoon problem
Date Tue, 04 Jan 2005 22:16:34 GMT
Siva,

  Are you using Struts Actions  (I presume so)?

  When you say you are getting XML output from the action class what is
being produced i.e. file or Object within the session etc ?

We are not using Struts currently but we were previously.

What we do is have an ActionBean (similar to ActionForm) per Action (Cocoon
Action in our case) which contains data that we want to "XMLize". This
ActionBean extends a generic ActionBean which has a toSAX method in it. The
generic toSAX method invokes a CreateXML method in our specific ActionBean
to create specific XML for that Action

In Generic ActionBean....

public final void toSAX(ContentHandler contentHandler) throws SAXException {
initRoot();
createXML(rootElement);
rootElement.toSAX(contentHandler);
}

In Specific ActionBean....

public void createXML(XMLElement rootElement) throws SAXException {

    rootElement.createXMLElement("userId", this.getUserId());  
}

In Sitemap we have ....

    <map:generators default="file">


 ...........
      <map:generator name="session-attr"
src="org.apache.cocoon.generation.SessionAttributeGenerator"/>
    </map:generators>

and then ...

      <map:match pattern="partLogin">  
        <map:generate type="session-attr" src="{global:LOGIN_ACTION_BEAN}"/>

        <map:serialize type="xml"/>  
      </map:match>

Therefore what happens when the entry in the sitemap matches is that it will
invoke the SessionAttributeGenerator with the parameter of the Actionbean
that we stored in the session. The SessionAttributeGenerator invokes the
toSAX method in that Bean which will create a SaxEvent which subsequently
gets serialized to XML in the sitemap.

Robert

-----Original Message-----
From: Siva [mailto:spshiva@gmail.com] 
Sent: Tuesday, 4 January 2005 5:12 PM
To: users@cocoon.apache.org
Subject: Struts with cocoon problem

Hi ,
      I am new to cocoon and  I am using cocoon with struts using
Struts- cocoon plugin.In this, i am getting XML output from the action
class(making form bean,request and session objects as XML),now I want
to process that XML with xsl using cocoon pipeline.I don't know how to
pass the dom object into the pipline dynamically.I do not want to pass
my xsl to generator, instead i want to pass the the XML to sitemap
something like this

    <map:match pattern="jsptopdf/pageOneJSP">
    <map:generate type="***DYNAMIC DOM OBJECT?????" />
    <map:transform src="context://fancy/fancy.xsl"/>
    <map:serialize type="html"/>
    </map:match>


Is it possible??...Could you please suggest me the correct way of solving
this..

Thanks -
Siva

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

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


Mime
View raw message